---
title: "numberOfItems(in:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscomboboxcelldatasource/numberofitems(in:)"
---

# numberOfItems(in:)

Returns the number of items managed for the combo box cell by your data source object.

## Declaration

```swift
optional func numberOfItems(in comboBoxCell: NSComboBoxCell) -> Int
```

## Parameters

- `comboBoxCell`: The combo box cell for which your data source manages items.

## Return Value

Return Value The number of items your data source object manages.

## Discussion

Discussion An NSComboBoxCell object uses this method to determine how many items it should display 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

### Instance Methods

- [comboBoxCell(_:completedString:)](appkit/nscomboboxcelldatasource/comboboxcell(_:completedstring:).md)
- [comboBoxCell(_:indexOfItemWithStringValue:)](appkit/nscomboboxcelldatasource/comboboxcell(_:indexofitemwithstringvalue:).md)
- [comboBoxCell(_:objectValueForItemAt:)](appkit/nscomboboxcelldatasource/comboboxcell(_:objectvalueforitemat:).md)
