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

# addTabViewItem(_:)

Adds the specified tab to the end of the tab view controller’s list of tabs.

```
func addTabViewItem(_ tabViewItem: NSTabViewItem)
```

## Parameters

`tabViewItem`

The tab view item to add. The tab view item must have an associated view controller. If this parameter is `nil` or if the tab view item does not have a view controller, this method raises an exception.

## Discussion

Use this method to add new tabs to a tab view controller. This method adds the tab’s associated view controller as a child of the tab view controller, so you do not need to call the [`addChild(_:)`](/documentation/AppKit/NSViewController/addChild(_:)) method directly. The view for the new view controller is not loaded until its corresponding tab is selected by the user.

If you override this method, you must call `super` at some point in your implementation.

---

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)