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

# tableView(_:sizeToFitWidthOfColumn:)

Asks the delegate to provide custom sizing behavior when a column’s resize divider is double clicked.

```
@MainActor optional func tableView(_ tableView: NSTableView, sizeToFitWidthOfColumn column: Int) -> CGFloat
```

## Parameters

`tableView`

The table view that sent the message.

`column`

The index of the column.

## Return Value

The width of the specified column.

## Discussion

By default, [`NSTableView`](/documentation/AppKit/NSTableView) iterates every row in the table, accesses a cell via [`preparedCell(atColumn:row:)`](/documentation/AppKit/NSTableView/preparedCell(atColumn:row:)), and requests the [`cellSize`](/documentation/AppKit/NSCell/cellSize) to find the appropriate largest width to use.

For accurate results and performance, it’s recommended that this method is implemented when using large tables. By default, large tables use a Monte Carlo simulation instead of iterating every row.

---

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)