---
title: "index(of:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nspopupbutton/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.

## Discussion

Discussion This method invokes the method of the same name of its NSPopUpButtonCell object.

## See Also

### Getting the indices of menu items

- [indexOfItem(withTag:)](appkit/nspopupbutton/indexofitem(withtag:).md)
- [indexOfItem(withTitle:)](appkit/nspopupbutton/indexofitem(withtitle:).md)
- [indexOfItem(withRepresentedObject:)](appkit/nspopupbutton/indexofitem(withrepresentedobject:).md)
- [indexOfItem(withTarget:andAction:)](appkit/nspopupbutton/indexofitem(withtarget:andaction:).md)
