---
title: "indexOfItem(withTitle:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsmenu/indexofitem(withtitle:)"
---

# indexOfItem(withTitle:)

Returns the index of the first menu item in the menu that has a specified title.

## Declaration

```swift
func indexOfItem(withTitle title: String) -> Int
```

## Parameters

- `title`: The title of a menu item in the menu.

## Return Value

Return Value The integer index of the menu item or, if no such menu item is in the menu, –1.

## See Also

### Related Documentation

- [item(at:)](appkit/nsmenu/item(at:).md)
- [item(withTitle:)](appkit/nsmenu/item(withtitle:).md)
- [insertItem(_:at:)](appkit/nsmenu/insertitem(_:at:).md)

### Finding Indices of Menu Items

- [index(of:)](appkit/nsmenu/index(of:).md)
- [indexOfItem(withTag:)](appkit/nsmenu/indexofitem(withtag:).md)
- [indexOfItem(withTarget:andAction:)](appkit/nsmenu/indexofitem(withtarget:andaction:).md)
- [indexOfItem(withRepresentedObject:)](appkit/nsmenu/indexofitem(withrepresentedobject:).md)
- [indexOfItem(withSubmenu:)](appkit/nsmenu/indexofitem(withsubmenu:).md)
