Skip to content

Commit

Permalink
supplementaryViewProvider optional type documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixHerrmann committed Jul 1, 2020
1 parent 5e0ea7a commit 15b52da
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ tableView.register(CustomCell.self, forCellReuseIdentifier: "customCell")
In order to use custom header or footer views, the `supplementaryViewProvider` property must be overritten.

```swift
override var supplementaryViewProvider: UICollectionViewDiffableDataSource<Section, Item>.SupplementaryViewProvider {
override var supplementaryViewProvider: UICollectionViewDiffableDataSource<Section, Item>.SupplementaryViewProvider? {
return { (collectionView, kind, indexPath) in
let headerView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "customHeader", for: indexPath) as? CustomHeader
switch self.dataSource.snapshot().sectionIdentifiers[indexPath.section] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ open class FHDiffableCollectionViewController<SectionIdentifierType, ItemIdentif
///
/// The default implementation just shows an empty section header.
///
/// override var supplementaryViewProvider: UICollectionViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType>.SupplementaryViewProvider {
/// override var supplementaryViewProvider: UICollectionViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType>.SupplementaryViewProvider? {
/// return { (collectionView, kind, indexPath) in
/// let supplementaryView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: /*your identifier*/, for: indexPath) as? CustomReuseableView
/// /*customize your supplementary view here*/
Expand Down

0 comments on commit 15b52da

Please sign in to comment.