<!--
{
  "availability" : [
    "macOS: 10.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTableViewDelegate/tableView(_:dataCellFor:row:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSTableViewDelegate(im)tableView:dataCellForTableColumn:row:"
  },
  "title" : "tableView(_:dataCellFor:row:)"
}
-->

# tableView(_:dataCellFor:row:)

Asks the delegate for a custom data cell for the specified row and column.

```
@MainActor optional func tableView(_ tableView: NSTableView, dataCellFor tableColumn: NSTableColumn?, row: Int) -> NSCell?
```

## Parameters

`tableView`

The table view that sent the message.

`tableColumn`

The table column.

`row`

The row index.

## Return Value

An [`NSCell`](/documentation/AppKit/NSCell) subclass that is used for the specified `row` and `tableColumn`. The returned cell must properly implement `copyWithZone:`.

## Discussion

A different data cell can be returned for any particular table column and row, or a cell that will be used for the entire row (that is, a full width cell).

If `tableColumn` is non-`nil`, you should return a cell (generally as the result of sending `tableColumn` a [`dataCell(forRow:)`](/documentation/AppKit/NSTableColumn/dataCell(forRow:)) message).

While each row is being drawn, this method is first called with a `tableColumn` value of `nil` to allow you to return a group cell—that is, a cell that will be used to draw the entire row. If you return a cell when `tableColumn` is `nil`, all implemented datasource and delegate methods must be prepared to handle a `nil` table column value. If you don’t return a cell, this method is called once for each `tableColumn` in `tableView`.

> Note:
> This method is only valid for ``doc://com.apple.appkit/documentation/AppKit/NSCell``-based table views.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)