<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: -",
    "tvOS: 13.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UICollectionViewDiffableDataSource-9tqpa/CellProvider",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "s:5UIKit34UICollectionViewDiffableDataSourceC12CellProvidera"
  },
  "title" : "UICollectionViewDiffableDataSource.CellProvider"
}
-->

# UICollectionViewDiffableDataSource.CellProvider

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

```
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

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:)`](/documentation/UIKit/UICollectionViewDiffableDataSource-9tqpa/init(collectionView:cellProvider:)).

## See Also

[`UICollectionViewDiffableDataSourceReference`](/documentation/UIKit/UICollectionViewDiffableDataSourceReference)

The object you use to manage data and provide cells for a collection view.

[Updating collection views using diffable data sources](/documentation/UIKit/updating-collection-views-using-diffable-data-sources)

Streamline the display and update of data in a collection view using a diffable data source that contains identifiers.

[Implementing modern collection views](/documentation/UIKit/implementing-modern-collection-views)

Bring compositional layouts to your app and simplify updating your user interface with diffable data sources.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)