---
title: UITableViewDiffableDataSource
framework: uikit
role: symbol
role_heading: Class
path: uikit/uitableviewdiffabledatasource-2euir
---

# UITableViewDiffableDataSource

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

## Declaration

```swift
@MainActor @preconcurrency class UITableViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType> where SectionIdentifierType : Hashable, SectionIdentifierType : Sendable, ItemIdentifierType : Hashable, ItemIdentifierType : Sendable
```

## Overview

Overview 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. dataSource = UITableViewDiffableDataSource<Int, UUID>(tableView: tableView) {     (tableView: UITableView, indexPath: IndexPath, itemIdentifier: UUID) -> UITableViewCell? in     // 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 NSDiffableDataSourceSnapshot. 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/uitableviewdiffabledatasource-2euir/init(tableview:cellprovider:).md)
- [UITableViewDiffableDataSource.CellProvider](uikit/uitableviewdiffabledatasource-2euir/cellprovider.md)

### Identifying items

- [itemIdentifier(for:)](uikit/uitableviewdiffabledatasource-2euir/itemidentifier(for:).md)
- [indexPath(for:)](uikit/uitableviewdiffabledatasource-2euir/indexpath(for:).md)

### Identifying sections

- [sectionIdentifier(for:)](uikit/uitableviewdiffabledatasource-2euir/sectionidentifier(for:).md)
- [index(for:)](uikit/uitableviewdiffabledatasource-2euir/index(for:).md)

### Updating data

- [snapshot()](uikit/uitableviewdiffabledatasource-2euir/snapshot().md)
- [apply(_:animatingDifferences:)](uikit/uitableviewdiffabledatasource-2euir/apply(_:animatingdifferences:).md)
- [apply(_:animatingDifferences:completion:)](uikit/uitableviewdiffabledatasource-2euir/apply(_:animatingdifferences:completion:).md)
- [applySnapshotUsingReloadData(_:)](uikit/uitableviewdiffabledatasource-2euir/applysnapshotusingreloaddata(_:).md)
- [applySnapshotUsingReloadData(_:completion:)](uikit/uitableviewdiffabledatasource-2euir/applysnapshotusingreloaddata(_:completion:).md)
- [defaultRowAnimation](uikit/uitableviewdiffabledatasource-2euir/defaultrowanimation.md)

### Supporting bridging

- [UITableViewDiffableDataSourceReference](uikit/uitableviewdiffabledatasourcereference.md)

### Debugging a diffable data source

- [description()](uikit/uitableviewdiffabledatasource-2euir/description().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)
- [SendableMetatype](swift/sendablemetatype.md)
- [UITableViewDataSource](uikit/uitableviewdatasource.md)

## See Also

### Data

- [Filling a table with data](uikit/filling-a-table-with-data.md)
- [Asynchronously loading images into table and collection views](uikit/asynchronously-loading-images-into-table-and-collection-views.md)
- [UITableViewDataSource](uikit/uitableviewdatasource.md)
- [UITableViewDataSourcePrefetching](uikit/uitableviewdatasourceprefetching.md)
- [NSDiffableDataSourceSnapshot](uikit/nsdiffabledatasourcesnapshot-swift.struct.md)
- [UILocalizedIndexedCollation](uikit/uilocalizedindexedcollation.md)
- [UIDataSourceTranslating](uikit/uidatasourcetranslating.md)
- [UIRefreshControl](uikit/uirefreshcontrol.md)
