Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add supplementary source example #169

Closed
wants to merge 2 commits into from
Closed

Conversation

rnystrom
Copy link
Contributor

@rnystrom rnystrom commented Nov 6, 2016

Changes in this pull request

Got around to adding a supplementary view source example.

Fixes #153 #163

img_0197

Pull request checklist

@rnystrom rnystrom force-pushed the supplementary-example branch from f255801 to 0fb3fd1 Compare November 6, 2016 22:05
@facebook-github-bot
Copy link
Contributor

@rnystrom updated the pull request - view changes

@coveralls
Copy link

Coverage Status

Coverage remained the same at 86.545% when pulling 0fb3fd1 on supplementary-example into 576ab4d on master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 86.545% when pulling 0fb3fd1 on supplementary-example into 576ab4d on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 86.545% when pulling 0fb3fd1 on supplementary-example into 576ab4d on master.


import IGListKit

class FeedItem: IGListDiffable {
Copy link
Contributor

Choose a reason for hiding this comment

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

final


import IGListKit

class FeedItemSectionController: IGListSectionController, IGListSectionType, IGListSupplementaryViewSource {
Copy link
Contributor

Choose a reason for hiding this comment

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

final

import UIKit
import IGListKit

class SupplementaryViewController: UIViewController, IGListAdapterDataSource {
Copy link
Contributor

Choose a reason for hiding this comment

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

final


import UIKit

class UserHeaderView: UICollectionViewCell {
Copy link
Contributor

Choose a reason for hiding this comment

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

final

Copy link
Contributor

@jessesquires jessesquires left a comment

Choose a reason for hiding this comment

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

👍

@facebook-github-bot
Copy link
Contributor

@rnystrom updated the pull request - view changes

@coveralls
Copy link

Coverage Status

Coverage remained the same at 86.545% when pulling 0e14011 on supplementary-example into 576ab4d on master.

@rnystrom rnystrom mentioned this pull request Nov 7, 2016
@facebook-github-bot
Copy link
Contributor

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

@rnystrom rnystrom deleted the supplementary-example branch November 7, 2016 15:43
@HumidBrains
Copy link

@rnystrom it would be great if this example could show how you would go about making the section headers sticky like on Instagram. Is it possible for you to help out with that? Thanks :)

@rnystrom
Copy link
Contributor Author

@HumidBrains if you're using UICollectionViewFlowLayout then all you have to do is set sectionHeadersPinToVisibleBounds to YES and you're good!

Within Instagram we hyper optimize and have written our own UICollectionViewLayout with sticky-header logic. The gist of it is to return NO when the bounds.origin changes in shouldInvalidateLayoutForBoundsChange: then in your layoutAttributesForSupplementaryViewOfKind:atIndexPath: do some math adjusting the frame origin of the attributes so they "stick".

I've seen some open source examples of this, but if you can, I'd just start off w/ UICollectionViewFlowLayout.

@HumidBrains
Copy link

HumidBrains commented Dec 14, 2016

@rnystrom thanks! And what layout framework are you recommending to use in conjunction with IGListKit and Swift? I saw someone asking about AsyncDisplayKit, but to me it looks like the benefits from using ASDisplayNode goes lost?

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.

5 participants