<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSComboBoxCell/indexOfItem(withObjectValue:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSComboBoxCell(im)indexOfItemWithObjectValue:"
  },
  "title" : "indexOfItem(withObjectValue:)"
}
-->

# indexOfItem(withObjectValue:)

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

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

## Parameters

`object`

The object for which to return the index.

## 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 <doc://com.apple.documentation/documentation/Swift/true>. If none of the objects in the combo box’s internal item list is equal to `anObject`, [`indexOfItem(withObjectValue:)`](/documentation/AppKit/NSComboBoxCell/indexOfItem(withObjectValue:)) returns `NSNotFound`.

## Discussion

This method logs a warning if [`usesDataSource`](/documentation/AppKit/NSComboBoxCell/usesDataSource) is <doc://com.apple.documentation/documentation/Swift/true>.

## See Also

[`selectItem(withObjectValue:)`](/documentation/AppKit/NSComboBoxCell/selectItem(withObjectValue:))

Selects the first pop-up list item that corresponds to the specified object.



---

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)