---
title: "comboBox(_:objectValueForItemAt:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscomboboxdatasource/combobox(_:objectvalueforitemat:)"
---

# comboBox(_:objectValueForItemAt:)

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

## Declaration

```swift
@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

Return Value The object corresponding to the specified index number.

## Discussion

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

### Related Documentation

- [NSComboBoxDataSource](appkit/nscomboboxdatasource.md)

### Instance Methods

- [comboBox(_:completedString:)](appkit/nscomboboxdatasource/combobox(_:completedstring:).md)
- [comboBox(_:indexOfItemWithStringValue:)](appkit/nscomboboxdatasource/combobox(_:indexofitemwithstringvalue:).md)
- [numberOfItems(in:)](appkit/nscomboboxdatasource/numberofitems(in:).md)
