---
title: "item(forIdentifier:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstouchbar/item(foridentifier:)"
---

# item(forIdentifier:)

Returns the Touch Bar item that corresponds to a given identifier.

## Declaration

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

## Return Value

Return Value A Touch Bar item if one exists for the given identifier; otherwise, returns nil.

## Discussion

Discussion 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: Items in the bar’s private array, which are reflected in the value of the itemIdentifiers array. Items in the templateItems array. 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 the table below.  |   |   |   |   |  For more on the proxy placeholder, see Composition and nesting.

## See Also

### Observing bar status

- [isVisible](appkit/nstouchbar/isvisible.md)
- [itemIdentifiers](appkit/nstouchbar/itemidentifiers.md)
