---
title: UITableViewDiffableDataSourceReference
framework: uikit
role: symbol
role_heading: Class
path: uikit/uitableviewdiffabledatasourcereference
---

# UITableViewDiffableDataSourceReference

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

## Declaration

```swift
@MainActor class UITableViewDiffableDataSourceReference
```

## Overview

Overview important: If you’re working in a Swift codebase, always use UITableViewDiffableDataSource instead. A diffable data source object is a specialized type of data source that works together with your table view object. It provides the behavior you need to manage updates to your table view’s data and UI in a simple, efficient way. It also conforms to the UITableViewDataSource protocol and provides implementations for all of the protocol’s methods. To fill a table view with data: Connect a diffable data source to your table view. Implement a cell provider to configure your table view’s cells. Generate the current state of the data. Display the data in the UI. To connect a diffable data source to a table view, you create the diffable data source using its init(tableView:cellProvider:) initializer, passing in the table view you want to associate with that data source. You also pass in a cell provider, where you configure each of your cells to determine how to display your data in the UI. self.dataSource = [[UITableViewDiffableDataSource alloc] initWithTableView:self.tableView cellProvider:^UITableViewCell *(UITableView *tableView, NSIndexPath *indexPath, id itemIdentifier) {     // configure and return cell }]; Then, you generate the current state of the data and display the data in the UI by constructing and applying a snapshot. For more information, see NSDiffableDataSourceSnapshotReference. important: Do not change the dataSource on the table view after you configure it with a diffable data source. If the table view needs a new data source after you configure it initially, create and configure a new table view and diffable data source.

## Topics

### Creating a diffable data source

- [init(tableView:cellProvider:)](uikit/uitableviewdiffabledatasourcereference/init(tableview:cellprovider:).md)
- [UITableViewDiffableDataSourceReferenceCellProvider](uikit/uitableviewdiffabledatasourcereferencecellprovider.md)

### Identifying items

- [itemIdentifier(for:)](uikit/uitableviewdiffabledatasourcereference/itemidentifier(for:).md)
- [indexPath(forItemIdentifier:)](uikit/uitableviewdiffabledatasourcereference/indexpath(foritemidentifier:).md)

### Identifying sections

- [sectionIdentifier(for:)](uikit/uitableviewdiffabledatasourcereference/sectionidentifier(for:).md)
- [index(forSectionIdentifier:)](uikit/uitableviewdiffabledatasourcereference/index(forsectionidentifier:).md)

### Updating data

- [snapshot()](uikit/uitableviewdiffabledatasourcereference/snapshot().md)
- [applySnapshot(_:animatingDifferences:)](uikit/uitableviewdiffabledatasourcereference/applysnapshot(_:animatingdifferences:).md)
- [applySnapshot(_:animatingDifferences:completion:)](uikit/uitableviewdiffabledatasourcereference/applysnapshot(_:animatingdifferences:completion:).md)
- [applySnapshot(usingReloadData:)](uikit/uitableviewdiffabledatasourcereference/applysnapshot(usingreloaddata:).md)
- [applySnapshot(usingReloadData:completion:)](uikit/uitableviewdiffabledatasourcereference/applysnapshot(usingreloaddata:completion:).md)
- [defaultRowAnimation](uikit/uitableviewdiffabledatasourcereference/defaultrowanimation.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)
- [UITableViewDataSource](uikit/uitableviewdatasource.md)
