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

# insertRows(at:withAnimation:)

Inserts the rows using the specified animation.

```
func insertRows(at indexes: IndexSet, withAnimation animationOptions: NSTableView.AnimationOptions = [])
```

## Parameters

`indexes`

The final positions of the new rows to be inserted.

`animationOptions`

The animation displayed during the insert. See [`NSTableView.AnimationOptions`](/documentation/AppKit/NSTableView/AnimationOptions) for the possible values that can be combined using the C bitwise OR operator.

## Discussion

The [`numberOfRows`](/documentation/AppKit/NSTableView/numberOfRows) in the table view is automatically increased by the count of `indexes`.

Calling this method multiple times within the same [`beginUpdates()`](/documentation/AppKit/NSTableView/beginUpdates()) and [`endUpdates()`](/documentation/AppKit/NSTableView/endUpdates()) block is allowed, and changes are processed incrementally.

> Note:
> ``doc://com.apple.appkit/documentation/AppKit/NSCell``-based table views must first call ``doc://com.apple.appkit/documentation/AppKit/NSTableView/beginUpdates()`` before calling this method.

---

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)