---
title: "moveColumn(_:toColumn:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstableview/movecolumn(_:tocolumn:)"
---

# moveColumn(_:toColumn:)

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

## Declaration

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

## Parameters

- `oldIndex`: The current index in the doc://com.apple.appkit/documentation/AppKit/NSTableView/tableColumns array of the column to move.
- `newIndex`: The new index in the doc://com.apple.appkit/documentation/AppKit/NSTableView/tableColumns array for the moved column.

## Discussion

Discussion This method posts columnDidMoveNotification to the default notification center.

## See Also

### Column Management

- [addTableColumn(_:)](appkit/nstableview/addtablecolumn(_:).md)
- [removeTableColumn(_:)](appkit/nstableview/removetablecolumn(_:).md)
- [tableColumns](appkit/nstableview/tablecolumns.md)
- [column(withIdentifier:)](appkit/nstableview/column(withidentifier:).md)
- [tableColumn(withIdentifier:)](appkit/nstableview/tablecolumn(withidentifier:).md)
