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

# insertTabViewItem(_:at:)

Inserts the specified item into the tab view’s array of tab view items at the specified index.

```
func insertTabViewItem(_ tabViewItem: NSTabViewItem, at index: Int)
```

## Parameters

`tabViewItem`

The tab view item to be added.

`index`

The index at which to insert the tab view item. The `index` parameter is zero-based.

## Discussion

If there is a delegate and the delegate supports it, sends the delegate the [`tabViewDidChangeNumberOfTabViewItems(_:)`](/documentation/AppKit/NSTabViewDelegate/tabViewDidChangeNumberOfTabViewItems(_:)) message.

## See Also

[`-  indexOfTabViewItemWithIdentifier:`](/documentation/AppKit/NSTabView/indexOfTabViewItem(withIdentifier:))

Returns the index of the item that matches the specified identifier or `NSNotFound` if the item is not found.

[`-  tabViewItemAtIndex:`](/documentation/AppKit/NSTabView/tabViewItem(at:)-7r3at)

Returns the tab view item at `index` in the tab view’s array of items.

[`numberOfTabViewItems`](/documentation/AppKit/NSTabView/numberOfTabViewItems)

The number of items in the tab view’s array of tab view items.

[`-  indexOfTabViewItem:`](/documentation/AppKit/NSTabView/indexOfTabViewItem(_:))

Returns the index of the specified item in the tab view.



---

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)