<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSComboBoxDataSource/comboBox(_:objectValueForItemAt:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSComboBoxDataSource(im)comboBox:objectValueForItemAtIndex:"
  },
  "title" : "comboBox(_:objectValueForItemAt:)"
}
-->

# comboBox(_:objectValueForItemAt:)

Returns the object that corresponds to the item at the specified index in the combo box.

```
@MainActor optional func comboBox(_ comboBox: NSComboBox, objectValueForItemAt index: Int) -> Any?
```

## Parameters

`comboBox`

The combo box.

`index`

The index of the item to return.

## Return Value

The object corresponding to the specified index number.

## Discussion

An `NSComboBox` object uses this method to populate the items displayed in its pop-up list.

> Important:
> While this method is marked as `@optional` in the protocol, you must implement this method if you are not providing the data for the combo box using Cocoa bindings.

## See Also

[`NSComboBoxDataSource`](/documentation/AppKit/NSComboBoxDataSource)



---

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)