---
title: "indexOfItem(withObjectValue:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscomboboxcell/indexofitem(withobjectvalue:)"
---

# indexOfItem(withObjectValue:)

Searches the combo box’s internal item list for the given object and returns the matching index number.

## Declaration

```swift
func indexOfItem(withObjectValue object: Any) -> Int
```

## Parameters

- `object`: The object for which to return the index.

## Return Value

Return Value The lowest index whose corresponding value is equal to anObject. Objects are considered equal if they have the same id or if isEqual: returns true. If none of the objects in the combo box’s internal item list is equal to anObject, indexOfItem(withObjectValue:) returns NSNotFound.

## Discussion

Discussion This method logs a warning if usesDataSource is true.

## See Also

### Related Documentation

- [selectItem(withObjectValue:)](appkit/nscomboboxcell/selectitem(withobjectvalue:).md)

### Manipulating the Displayed List

- [itemObjectValue(at:)](appkit/nscomboboxcell/itemobjectvalue(at:).md)
- [noteNumberOfItemsChanged()](appkit/nscomboboxcell/notenumberofitemschanged().md)
- [reloadData()](appkit/nscomboboxcell/reloaddata().md)
- [scrollItemAtIndexToTop(_:)](appkit/nscomboboxcell/scrollitematindextotop(_:).md)
- [scrollItemAtIndexToVisible(_:)](appkit/nscomboboxcell/scrollitematindextovisible(_:).md)
