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

# tableView(_:shouldReorderColumn:toColumn:)

Asks the delegate to allow or prohibit the specified column to be dragged to a new location.

```
@MainActor optional func tableView(_ tableView: NSTableView, shouldReorderColumn columnIndex: Int, toColumn newColumnIndex: Int) -> Bool
```

## Parameters

`tableView`

The table view that sent the message.

`columnIndex`

The index of the column being dragged.

`newColumnIndex`

The proposed target index of the column.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the column reordering should be allowed, otherwise <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

When a column is initially dragged by the user, the delegate is first called with a `newColumnIndex` value of `-1`. Returning <doc://com.apple.documentation/documentation/Swift/false> will disallow that column from being reordered at all. Returning <doc://com.apple.documentation/documentation/Swift/true> allows it to be reordered, and the delegate will be called again when the column reaches a new location.

The actual [`NSTableColumn`](/documentation/AppKit/NSTableColumn) instance can be retrieved from the [`tableColumns`](/documentation/AppKit/NSTableView/tableColumns) array.

If this method isn’t implemented, all columns are considered reorderable.

---

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)