---
title: "numberOfItems(inSection:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscollectionview/numberofitems(insection:)"
---

# numberOfItems(inSection:)

Returns the number of items in the specified section.

## Declaration

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

Return Value The number of items in the section.

## Discussion

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.

## See Also

### Getting the State of the Collection View

- [numberOfSections](appkit/nscollectionview/numberofsections.md)
