---
title: "init(tableView:cellProvider:)"
framework: uikit
role: symbol
role_heading: Initializer
path: "uikit/uitableviewdiffabledatasource-2euir/init(tableview:cellprovider:)"
---

# init(tableView:cellProvider:)

Creates a diffable data source with the specified cell provider, and connects it to the specified table view.

## Declaration

```swift
@MainActor @preconcurrency init(tableView: UITableView, cellProvider: @escaping UITableViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType>.CellProvider)
```

## Parameters

- `tableView`: The initialized table view object to connect to the diffable data source.
- `cellProvider`: A closure that creates and returns each of the cells for the table view from the data the diffable data source provides.

## See Also

### Creating a diffable data source

- [UITableViewDiffableDataSource.CellProvider](uikit/uitableviewdiffabledatasource-2euir/cellprovider.md)
