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

# NSTabViewController

A container view controller that manages a tab view interface, which organizes multiple pages of content but displays only one page at a time.

```
class NSTabViewController
```

## Overview

Each page of content is managed by a separate child view controller. Navigation between child view controllers is accomplished with the help of an [`NSTabView`](/documentation/AppKit/NSTabView) object, which the tab view controller manages. When the user selects a new tab, the tab view controller displays the content associated with the associated child view controller, replacing the previous content.

Each tab is represented by an [`NSTabViewItem`](/documentation/AppKit/NSTabViewItem) object, which contains the name of the tab and stores a pointer to the child view controller that manages the tab’s content. Normally, you configure the tab view items at design time using Interface Builder, but you can also add them programmatically using the methods of this class. Always assign a child view controller to new tab view items before adding those items to the tab view interface.

Another way to add tabs programmatically is to add child view controllers directly to the tab view controller. When you call the [`addChild(_:)`](/documentation/AppKit/NSViewController/addChild(_:)) or [`insertChild(_:at:)`](/documentation/AppKit/NSViewController/insertChild(_:at:)) method of this class, the tab view controller automatically creates a default [`NSTabViewItem`](/documentation/AppKit/NSTabViewItem) object for the specified view controller. You can fetch the newly created item using the [`tabViewItem(for:)`](/documentation/AppKit/NSTabViewController/tabViewItem(for:)) method and configure it. Removing a child view controller with the [`removeChild(at:)`](/documentation/AppKit/NSViewController/removeChild(at:)) method similarly removes the corresponding tab view item.

The tab view controller lazily loads the views associated with each child view controller, creating them only after the corresponding tab is selected. When the tab view controller’s view is first displayed, only the view for the initially selected tab is loaded.

The [`tabStyle`](/documentation/AppKit/NSTabViewController/tabStyle-swift.property) property determines the appearance of the tab controls. A tab view controller can display a segmented control or display tabs in the window’s toolbar. You can also provide your own control for displaying tabs. The tab view controller automatically coordinates interactions between designated control and the corresponding [`tabView`](/documentation/AppKit/NSTabViewController/tabView) object.

## Topics

### Configuring the Tab View

[`tabStyle`](/documentation/AppKit/NSTabViewController/tabStyle-swift.property)

The style used to display the tabs.

[`tabView`](/documentation/AppKit/NSTabViewController/tabView)

The tab view that manages the views of the interface.

[`transitionOptions`](/documentation/AppKit/NSTabViewController/transitionOptions)

The animation options to use when switching between tabs.

[`canPropagateSelectedChildViewControllerTitle`](/documentation/AppKit/NSTabViewController/canPropagateSelectedChildViewControllerTitle)

A Boolean value indicating whether the tab view controller gets its title from the selected child view controller.

### Managing Tab View Items

[`tabViewItems`](/documentation/AppKit/NSTabViewController/tabViewItems)

The array of tab view items used to manage each of the child view controllers.

[`tabViewItem(for:)`](/documentation/AppKit/NSTabViewController/tabViewItem(for:))

Returns the tab view item for the specified child view controller.

[`addTabViewItem(_:)`](/documentation/AppKit/NSTabViewController/addTabViewItem(_:))

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

[`insertTabViewItem(_:at:)`](/documentation/AppKit/NSTabViewController/insertTabViewItem(_:at:))

Inserts a tab view into the tab view controller’s list of tabs.

[`removeTabViewItem(_:)`](/documentation/AppKit/NSTabViewController/removeTabViewItem(_:))

Removes the specified tab view item from the tab view controller.

[`selectedTabViewItemIndex`](/documentation/AppKit/NSTabViewController/selectedTabViewItemIndex)

The index of the selected tab.

### Responding to Tab View Events

[`viewDidLoad()`](/documentation/AppKit/NSTabViewController/viewDidLoad())

Called after the view controller’s view has been loaded into memory.

[`tabView(_:shouldSelect:)`](/documentation/AppKit/NSTabViewController/tabView(_:shouldSelect:))

Asks the tab view controller if the specified tab should be selected.

[`tabView(_:willSelect:)`](/documentation/AppKit/NSTabViewController/tabView(_:willSelect:))

Informs the tab view controller that the specified tab is about to be selected.

[`tabView(_:didSelect:)`](/documentation/AppKit/NSTabViewController/tabView(_:didSelect:))

Informs the tab view controller that the specified tab was selected.

### Responding to Toolbar Events

[`toolbar(_:itemForItemIdentifier:willBeInsertedIntoToolbar:)`](/documentation/AppKit/NSTabViewController/toolbar(_:itemForItemIdentifier:willBeInsertedIntoToolbar:))

Returns the toolbar item for the specified identifier.

[`toolbarAllowedItemIdentifiers(_:)`](/documentation/AppKit/NSTabViewController/toolbarAllowedItemIdentifiers(_:))

Returns the array of identifier strings for the allowed toolbar items.

[`toolbarDefaultItemIdentifiers(_:)`](/documentation/AppKit/NSTabViewController/toolbarDefaultItemIdentifiers(_:))

Returns the array of identifier strings for the default toolbar items.

[`toolbarSelectableItemIdentifiers(_:)`](/documentation/AppKit/NSTabViewController/toolbarSelectableItemIdentifiers(_:))

Returns the array of identifier strings for the selectable toolbar items

### Constants

[`NSTabViewController.TabStyle`](/documentation/AppKit/NSTabViewController/TabStyle-swift.enum)

Tab control style options for a tab view controller.



---

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)