<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSToolbarDelegate/toolbar(_:itemIdentifier:canBeInsertedAt:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSToolbarDelegate(im)toolbar:itemIdentifier:canBeInsertedAtIndex:"
  },
  "title" : "toolbar(_:itemIdentifier:canBeInsertedAt:)"
}
-->

# toolbar(_:itemIdentifier:canBeInsertedAt:)

Asks the delegate for a Boolean value that indicates whether the toolbar can place the item at the specified position.

```
@MainActor optional func toolbar(_ toolbar: NSToolbar, itemIdentifier: NSToolbarItem.Identifier, canBeInsertedAt index: Int) -> Bool
```

## Parameters

`toolbar`

The toolbar that contains the items.

`itemIdentifier`

The identifier of the toolbar item to insert at the specified index.

`index`

The proposed index at which to place the item. If the toolbar is removing the item, this value is <doc://com.apple.documentation/documentation/Foundation/NSNotFound-4qp9h>.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> to allow the toolbar to place the item at the specified location, or <doc://com.apple.documentation/documentation/Swift/false> to prevent the toolbar from placing the item in that location.

## Discussion

Implement this method to control the placement of items in the toolbar. During a drag operation, the toolbar calls this method to determine if the specified index is an acceptable location for the item. Return a Boolean value that indicates whether the new posiition is acceptable.

Don’t use the `index` parameter to determine the final location of the toolbar item. During a drag operation, the toolbar can call this method multiple times, so the index value can change later.

---

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)