UICollectionViewDiffableDataSource.CellProvider
A closure that configures and returns a cell for a collection view from its diffable data source.
Declaration
typealias CellProvider = (UICollectionView, IndexPath, ItemIdentifierType) -> UICollectionViewCell?Parameters
- collectionView:
The collection view to configure this cell for.
- indexPath:
The index path that specifies the location of the cell in the collection view.
- itemIdentifier:
An object, with a type that implements the Hashable protocol, the data source uses to uniquely identify the item for this cell.
Return Value
A non-nil configured cell object. The cell provider must return a valid cell object to the collection view.
Discussion
You use this closure to configure and return cells when creating a diffable data source using init(collectionView:cellProvider:).
See Also
Related Documentation
UICollectionViewDiffableDataSourceReferenceUpdating collection views using diffable data sourcesImplementing modern collection views