---
title: NSToolbarDelegate
framework: appkit
role: symbol
role_heading: Protocol
path: appkit/nstoolbardelegate
---

# NSToolbarDelegate

A set of optional methods you use to configure the toolbar and respond to changes.

## Declaration

```swift
protocol NSToolbarDelegate : NSObjectProtocol
```

## Overview

Overview Use the methods of NSToolbarDelegate to customize the behavior of your toolbars. You might use these methods to track the addition or removal of toolbar items, or use them to prevent someone from rearranging or removing specific items. Adopt this protocol in one of your custom objects and assign that object to the delegate property of the NSToolbar object you want to manage.

## Topics

### Adding and removing items

- [toolbar(_:itemForItemIdentifier:willBeInsertedIntoToolbar:)](appkit/nstoolbardelegate/toolbar(_:itemforitemidentifier:willbeinsertedintotoolbar:).md)
- [toolbarWillAddItem(_:)](appkit/nstoolbardelegate/toolbarwilladditem(_:).md)
- [toolbarDidRemoveItem(_:)](appkit/nstoolbardelegate/toolbardidremoveitem(_:).md)
- [NSToolbar.Identifier](appkit/nstoolbar/identifier-swift.typealias.md)

### Configuring the behavior of items

- [toolbarAllowedItemIdentifiers(_:)](appkit/nstoolbardelegate/toolbaralloweditemidentifiers(_:).md)
- [toolbarDefaultItemIdentifiers(_:)](appkit/nstoolbardelegate/toolbardefaultitemidentifiers(_:).md)
- [toolbarImmovableItemIdentifiers(_:)](appkit/nstoolbardelegate/toolbarimmovableitemidentifiers(_:).md)
- [toolbarSelectableItemIdentifiers(_:)](appkit/nstoolbardelegate/toolbarselectableitemidentifiers(_:).md)
- [toolbar(_:itemIdentifier:canBeInsertedAt:)](appkit/nstoolbardelegate/toolbar(_:itemidentifier:canbeinsertedat:).md)

## Relationships

### Inherits From

- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

### Conforming Types

- [NSTabViewController](appkit/nstabviewcontroller.md)

## See Also

### Configuring the toolbar contents

- [delegate](appkit/nstoolbar/delegate.md)
