---
title: "moveRow(at:to:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstableview/moverow(at:to:)"
---

# moveRow(at:to:)

Moves the specified row to the new row location using animation.

## Declaration

```swift
func moveRow(at oldIndex: Int, to newIndex: Int)
```

## Parameters

- `oldIndex`: Initial row index.
- `newIndex`: New row index.

## Discussion

Discussion This is similar to removing a row at oldIndex and inserting it at newIndex, except the same view is used and simply has its position updated to the new location. Changes happen incrementally as they are sent to the table, so as soon as this method is called the row can be considered moved. However the underlying view is not moved until endUpdates() has been called. This method can be called multiple times within the same beginUpdates() and endUpdates() block. note: NSCell-based table views must first call beginUpdates() before calling this method.

## See Also

### Updating the Table View Arrangement

- [beginUpdates()](appkit/nstableview/beginupdates().md)
- [endUpdates()](appkit/nstableview/endupdates().md)
- [insertRows(at:withAnimation:)](appkit/nstableview/insertrows(at:withanimation:).md)
- [removeRows(at:withAnimation:)](appkit/nstableview/removerows(at:withanimation:).md)
- [row(for:)](appkit/nstableview/row(for:).md)
- [column(for:)](appkit/nstableview/column(for:).md)
