---
title: UICollectionView.CellRegistration
framework: uikit
role: symbol
role_heading: Structure
path: uikit/uicollectionview/cellregistration
---

# UICollectionView.CellRegistration

A registration for the collection view’s cells.

## Declaration

```swift
struct CellRegistration<Cell, Item> where Cell : UICollectionViewCell
```

## Overview

Overview Use a cell registration to register cells with your collection view and configure each cell for display. You create a cell registration with your cell type and data item type as the registration’s generic parameters, passing in a registration handler to configure the cell. In the registration handler, you specify how to configure the content and appearance of that type of cell. The following example creates a cell registration for cells of type UICollectionViewListCell. It creates a content configuration with a system default style, customizes the content and appearance of the configuration, and then assigns the configuration to the cell. let cellRegistration = UICollectionView.CellRegistration<UICollectionViewListCell, Int> { cell, indexPath, item in          var contentConfiguration = cell.defaultContentConfiguration()          contentConfiguration.text = "\(item)"     contentConfiguration.textProperties.color = .lightGray          cell.contentConfiguration = contentConfiguration } After you create a cell registration, you pass it in to dequeueConfiguredReusableCell(using:for:item:), which you call from your data source’s cell provider. dataSource = UICollectionViewDiffableDataSource<Section, Int>(collectionView: collectionView) {     (collectionView: UICollectionView, indexPath: IndexPath, itemIdentifier: Int) -> UICollectionViewCell? in          return collectionView.dequeueConfiguredReusableCell(using: cellRegistration,                                                         for: indexPath,                                                         item: itemIdentifier) } You don’t need to call register(_:forCellWithReuseIdentifier:) or register(_:forCellWithReuseIdentifier:). The collection view registers your cell automatically when you pass the cell registration to dequeueConfiguredReusableCell(using:for:item:). important: Don’t create your cell registration inside a UICollectionViewDiffableDataSource.CellProvider closure; doing so prevents cell reuse, and generates an exception in iOS 15 and higher.

## Topics

### Creating a cell registration

- [init(handler:)](uikit/uicollectionview/cellregistration/init(handler:).md)
- [init(cellNib:handler:)](uikit/uicollectionview/cellregistration/init(cellnib:handler:).md)
- [UICollectionView.CellRegistration.Handler](uikit/uicollectionview/cellregistration/handler.md)

## See Also

### Creating cells

- [dequeueConfiguredReusableCell(using:for:item:)](uikit/uicollectionview/dequeueconfiguredreusablecell(using:for:item:).md)
- [register(_:forCellWithReuseIdentifier:)](uikit/uicollectionview/register(_:forcellwithreuseidentifier:)-3vaho.md)
- [register(_:forCellWithReuseIdentifier:)](uikit/uicollectionview/register(_:forcellwithreuseidentifier:)-6z6t4.md)
- [dequeueReusableCell(withReuseIdentifier:for:)](uikit/uicollectionview/dequeuereusablecell(withreuseidentifier:for:).md)
