I'm trying to shift my current UITableView to UICollectionView with compositional layout and new configuration API.
So UICollectionViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType> has two generic types for section and item and two providers
The problem is that only CellProvider accepts data (ItemIdentifierType) as a parameter and I can configure the cell with it. SupplementaryViewProvider doesn't have SectionIdentifierType in its parameters so I can't understand how to properly configure section header/footer with section data. I don't want to use IndexPath to find necessary section data in some kind of collection view's data array since it is the same approach as previous delegate API.
What is the solution for creating list with custom section headers in new API?
So UICollectionViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType> has two generic types for section and item and two providers
Code Block public typealias CellProvider = (UICollectionView, IndexPath, ItemIdentifierType) -> UICollectionViewCell? public typealias SupplementaryViewProvider = (UICollectionView, String, IndexPath) -> UICollectionReusableView?
The problem is that only CellProvider accepts data (ItemIdentifierType) as a parameter and I can configure the cell with it. SupplementaryViewProvider doesn't have SectionIdentifierType in its parameters so I can't understand how to properly configure section header/footer with section data. I don't want to use IndexPath to find necessary section data in some kind of collection view's data array since it is the same approach as previous delegate API.
What is the solution for creating list with custom section headers in new API?