---
title: "numberOfItems(inSection:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsdiffabledatasourcesnapshot-swift.struct/numberofitems(insection:)"
---

# numberOfItems(inSection:)

Returns the number of items in the specified section of the snapshot.

## Declaration

```swift
func numberOfItems(inSection identifier: SectionIdentifierType) -> Int
```

## Parameters

- `identifier`: The identifier of the section of the snapshot.

## Return Value

Return Value The number of items in the specified section. This method returns 0 if the section is empty.

## Discussion

Discussion If you call this method with the identifier of a section that doesn’t exist in the snapshot, the app throws an error.

## See Also

### Getting Item and Section Metrics

- [numberOfItems](appkit/nsdiffabledatasourcesnapshot-swift.struct/numberofitems.md)
- [numberOfSections](appkit/nsdiffabledatasourcesnapshot-swift.struct/numberofsections.md)
