Created
March 25, 2020 16:20
-
-
Save artur-ios-dev/34311311b4ccfd243fe6ccb4a77f6659 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dataSource.supplementaryViewProvider = { collectionView, kind, indexPath -> UICollectionReusableView? in | |
switch kind { | |
case UICollectionView.elementKindSectionHeader: | |
guard let headerView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sampleHeaderIdentifier", for: indexPath) as? SampleCollectionReusableView else { | |
fatalError("Header is not registered") | |
} | |
headerView.fill(with: "My Awesome Colours") | |
return headerView | |
default: | |
fatalError("Element \(kind) not supported") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment