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

# moveColumn(_:toColumn:)

Moves the column and heading at the specified index to the new specified index.

```
func moveColumn(_ oldIndex: Int, toColumn newIndex: Int)
```

## Parameters

`oldIndex`

The current index in the [`tableColumns`](/documentation/AppKit/NSTableView/tableColumns) array of the column to move.

`newIndex`

The new index in the [`tableColumns`](/documentation/AppKit/NSTableView/tableColumns) array for the moved column.

## Discussion

This method posts [`columnDidMoveNotification`](/documentation/AppKit/NSTableView/columnDidMoveNotification) to the default notification center.

---

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)