Instance Method


Returns an instantiated NSTouchBarItem instance that corresponds to a given identifier.


func item(forIdentifier identifier: NSTouchBarItem.Identifier) -> NSTouchBarItem?


The system returns items (instances of the NSTouchBarItem class) as it finds them, according to the following search order, listed here from first-searched to last-searched:

1. Items in the bar’s private array, which are reflected in the value of the itemIdentifiers array.

2. Items in the templateItems array.

3. Items returned from the bar delegate’s touchBar(_:makeItemForIdentifier:) method.

Your app never needs to instantiate spacing or proxy items because these are created by the system directly, according to their identifiers, as shown in Table 1.

Table 1

Identifiers for spacing and proxy touch bar items.


Resulting item


small space


large space


flexible space


proxy placeholder

For more on the proxy placeholder, see NSTouchBar Composition and Nesting.

See Also

Observing Bar Status

var isVisible: Bool

Indicates whether the bar is eligible for display.

var itemIdentifiers: [NSTouchBarItem.Identifier]

The read-only list of identifiers for the items (NSTouchBarItem instances) for the bar, as currently configured by the user.