---
title: "index(of:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nspopupbuttoncell/index(of:)"
---

# index(of:)

Returns the index of the specified menu item.

## Declaration

```swift
func index(of item: NSMenuItem) -> Int
```

## Parameters

- `item`: The menu item whose index you want.

## Return Value

Return Value The index of the item or -1 if no such item was found.

## See Also

### Related Documentation

- [indexOfSelectedItem](appkit/nspopupbuttoncell/indexofselecteditem.md)

### Accessing the items

- [itemArray](appkit/nspopupbuttoncell/itemarray.md)
- [numberOfItems](appkit/nspopupbuttoncell/numberofitems.md)
- [indexOfItem(withTitle:)](appkit/nspopupbuttoncell/indexofitem(withtitle:).md)
- [indexOfItem(withTag:)](appkit/nspopupbuttoncell/indexofitem(withtag:).md)
- [indexOfItem(withRepresentedObject:)](appkit/nspopupbuttoncell/indexofitem(withrepresentedobject:).md)
- [indexOfItem(withTarget:andAction:)](appkit/nspopupbuttoncell/indexofitem(withtarget:andaction:).md)
- [item(at:)](appkit/nspopupbuttoncell/item(at:).md)
- [item(withTitle:)](appkit/nspopupbuttoncell/item(withtitle:).md)
- [lastItem](appkit/nspopupbuttoncell/lastitem.md)
