Skip to content

Fixed tail loading example (#105)#109

Closed
Sherlouk wants to merge 3 commits intoInstagram:masterfrom
Sherlouk:tail-loading-example
Closed

Fixed tail loading example (#105)#109
Sherlouk wants to merge 3 commits intoInstagram:masterfrom
Sherlouk:tail-loading-example

Conversation

@Sherlouk
Copy link
Copy Markdown
Contributor

@Sherlouk Sherlouk commented Oct 22, 2016

Changes in this pull request

  • Fixes 'Tail Loading' example doesn't add new cells the second time you pull the table view #105
  • Added a 'SpinnerSectionController' allowing us to trigger the activity spinner each time
  • Changed the words array to be numbers instead (I found it personally difficult to realise if more cells were actually added as the text didn't seem to change, by using numbers you can quite clearly see it increment by 5 each time you load more)
  • No changes/new tests as it is a fix to an example

Pull request checklist

  • All tests pass. Demo project builds and runs.
  • I added tests, an experiment, or detailed why my change isn't tested.
  • I have reviewed the contributing guide

@facebook-github-bot
Copy link
Copy Markdown
Contributor

Thank you for your pull request. We require contributors to sign our Contributor License Agreement, and yours has expired.

Before we can review or merge your code, we need you to email cla@fb.com with your details so we can update your status.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

Copy link
Copy Markdown
Contributor

@rnystrom rnystrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love these changes, but could we keep the IGListSingleSectionController? With that I think we're g2g.


func didUpdate(to object: Any) {
self.object = object as? String
self.object = String(describing: object)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL 🤓


func cellForItem(at index: Int) -> UICollectionViewCell {
let cell = collectionContext!.dequeueReusableCell(of: SpinnerCell.self, for: self, at: index) as! SpinnerCell
cell.activityIndicator.startAnimating()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just update the function using IGListSingleSectionController to call startAnimating() in the configureBlock(...) instead of making a new section controller?

I just want to make sure we have an example using the single section controller somewhere.

let collectionView = IGListCollectionView(frame: CGRect.zero, collectionViewLayout: UICollectionViewFlowLayout())

lazy var words = "Maecenas faucibus mollis interdum Praesent commodo cursus magna, vel scelerisque nisl consectetur et".components(separatedBy: " ")
lazy var items = Array(0...20)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree w/ this, makes it much more clear that we're appending new data.

}
return items

return objects
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great!

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@Sherlouk updated the pull request - view changes

{
"images" : [
{
"idiom" : "iphone",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had told it not to commit this 🤔
Xcode be really wanting this change to happen!

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@Sherlouk updated the pull request - view changes

let configureBlock = { (item: Any, cell: UICollectionViewCell) in}
let configureBlock = { (item: Any, cell: UICollectionViewCell) in
guard let cell = cell as? SpinnerCell else { return }
cell.activityIndicator.startAnimating()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️ thank you!

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@rnystrom has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@Sherlouk Sherlouk deleted the tail-loading-example branch December 30, 2016 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

'Tail Loading' example doesn't add new cells the second time you pull the table view

3 participants