<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSComboBoxCellDataSource/numberOfItems(in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSComboBoxCellDataSource(im)numberOfItemsInComboBoxCell:"
  },
  "title" : "numberOfItems(in:)"
}
-->

# numberOfItems(in:)

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

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

## Parameters

`comboBoxCell`

The combo box cell for which your data source manages items.

## Return Value

The number of items your data source object manages.

## 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**.

---

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)