---
title: "init(tableView:cellProvider:)"
framework: appkit
role: symbol
role_heading: Initializer
path: "appkit/nstableviewdiffabledatasource-c5gl/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
init(tableView: NSTableView, cellProvider: @escaping NSTableViewDiffableDataSource<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. This replaces the doc://com.apple.appkit/documentation/AppKit/NSTableViewDelegate/tableView(_:viewFor:row:) delegate method.

## See Also

### Creating a Diffable Data Source

- [NSTableViewDiffableDataSource.CellProvider](appkit/nstableviewdiffabledatasource-c5gl/cellprovider.md)
