Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.