Last active
May 3, 2020 09:13
-
-
Save michzio/3ee49dbe297dd7fa2b175d83411f633c 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
// MARK: - Setup | |
extension CollectionViewController { | |
private func configureCollectionView() { | |
view.addSubview(collectionView) | |
collectionView.register(HostingControllerCollectionViewCell<AnyView>.self, forCellWithReuseIdentifier: HostingControllerCollectionViewCell<AnyView>.reuseIdentifier) | |
collectionView.register(BadgeSupplementaryView.self, forSupplementaryViewOfKind: "badge", withReuseIdentifier: BadgeSupplementaryView.reuseIdentifier) | |
collectionView.register(EmptySupplementaryView.self, forSupplementaryViewOfKind: "badge", withReuseIdentifier: EmptySupplementaryView.reuseIdentifier) | |
supplementaryKinds.forEach { kind in | |
collectionView.register(HostingControllerCollectionReusableView<AnyView>.self, forSupplementaryViewOfKind: kind, withReuseIdentifier: HostingControllerCollectionReusableView<AnyView>.reuseIdentifier) | |
} | |
} | |
private func configureDataSource() { | |
dataSource = UICollectionViewDiffableDataSource<Section, Item>(collectionView: collectionView, cellProvider: cellProvider) | |
dataSource.supplementaryViewProvider = supplementaryViewProvider | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment