---
title: "collectionView(_:numberOfItemsInSection:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uicollectionviewdatasource/collectionview(_:numberofitemsinsection:)"
---

# collectionView(_:numberOfItemsInSection:)

Asks your data source object for the number of items in the specified section.

## Declaration

```swift
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
```

## Parameters

- `collectionView`: The collection view requesting this information.
- `section`: An index number identifying a section in collectionView. This index value is 0-based.

## Return Value

Return Value The number of items in section.

## See Also

### Getting item and section metrics

- [numberOfSections(in:)](uikit/uicollectionviewdatasource/numberofsections(in:).md)
