Skip to content

SupplementaryViewFactory for section headers and footers #3

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

Merged
merged 5 commits into from
Feb 12, 2020

Conversation

alexjameslittle
Copy link
Contributor

No description provided.

Copy link
Collaborator

@icanzilb icanzilb left a comment

Choose a reason for hiding this comment

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

That addition makes a lot of sense, as supplementary view support is currently lacking. I left a couple of small question for you, and thanks for the PR

@@ -97,6 +100,10 @@ public class CollectionViewItemsController<CollectionType>: NSObject, UICollecti
public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
cellFactory(self, collectionView, indexPath, collection[indexPath.section][indexPath.row])
}

public func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
return configureSupplementaryView!(self, collectionView, kind, indexPath, collection[indexPath.section])
Copy link
Collaborator

Choose a reason for hiding this comment

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

configureSupplementaryView is optional, right? do you need to force unwrap it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes because the collection view delegate method requires a returned supplementary view. Unless we were to guard it and cause a fatal error with a message saying the property must not be nil

@@ -31,6 +32,8 @@ public class CollectionViewItemsController<CollectionType>: NSObject, UICollecti

/// A fallback data source to implement custom logic like indexes, dragging, etc.
public var dataSource: UICollectionViewDataSource?

open var configureSupplementaryView: SupplementaryViewFactory?
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there a specific reason this property needs to be open?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, will change this to public

@alexjameslittle
Copy link
Contributor Author

@icanzilb Updated the PR

@icanzilb
Copy link
Collaborator

@icanzilb Updated the PR

Looks good thank you! Will go about merging it when I have a moment

Copy link
Collaborator

@icanzilb icanzilb left a comment

Choose a reason for hiding this comment

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

Thanks!

@icanzilb icanzilb merged commit 32a198d into CombineCommunity:master Feb 12, 2020
@icanzilb
Copy link
Collaborator

@alexjameslittle I'm sorry but I merged this by mistake. There were no tests for the new code - could you create a separate PR with those?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants