<!--
{
  "availability" : [
    "macOS: 10.11.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSCollectionView/numberOfItems(inSection:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCollectionView(im)numberOfItemsInSection:"
  },
  "title" : "numberOfItems(inSection:)"
}
-->

# numberOfItems(inSection:)

Returns the number of items in the specified section.

```
func numberOfItems(inSection section: Int) -> Int
```

## Parameters

`section`

The index of the section whose item count you want. This index is 0-based.

## Return Value

The number of items in the section.

## Discussion

Use this method to get the number of items currently displayed by the collection view for the specified section. Do not call the methods of the data source to get this information.

---

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)