---
title: UICollectionViewDiffableDataSource.CellProvider
framework: uikit
role: symbol
role_heading: Type Alias
path: uikit/uicollectionviewdiffabledatasource-9tqpa/cellprovider
---

# UICollectionViewDiffableDataSource.CellProvider

A closure that configures and returns a cell for a collection view from its diffable data source.

## Declaration

```swift
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 doc://com.apple.documentation/documentation/Swift/Hashable protocol, the data source uses to uniquely identify the item for this cell.

## Return Value

Return Value A non-nil configured cell object. The cell provider must return a valid cell object to the collection view.

## Discussion

Discussion You use this closure to configure and return cells when creating a diffable data source using init(collectionView:cellProvider:).

## See Also

### Related Documentation

- [UICollectionViewDiffableDataSourceReference](uikit/uicollectionviewdiffabledatasourcereference.md)
- [Updating collection views using diffable data sources](uikit/updating-collection-views-using-diffable-data-sources.md)
- [Implementing modern collection views](uikit/implementing-modern-collection-views.md)

### Creating a diffable data source

- [init(collectionView:cellProvider:)](uikit/uicollectionviewdiffabledatasource-9tqpa/init(collectionview:cellprovider:).md)
