---
title: sectionSnapshotHandlers
framework: uikit
role: symbol
role_heading: Instance Property
path: uikit/uicollectionviewdiffabledatasource-9tqpa/sectionsnapshothandlers-swift.property
---

# sectionSnapshotHandlers

The diffable data source’s handlers for expanding and collapsing items.

## Declaration

```swift
@MainActor @preconcurrency var sectionSnapshotHandlers: UICollectionViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType>.SectionSnapshotHandlers<ItemIdentifierType> { get set }
```

## Discussion

Discussion Provide section snapshot handlers to support the expanding or collapsing of items in your collection view. Use the snapshotForExpandingParent handler to customize the snapshot that returns when a particular parent item is expanded. // Allow every item to be collapsed dataSource.sectionSnapshotHandlers.shouldCollapseItem = { item in return true }

dataSource.sectionSnapshotHandlers.snapshotForExpandingParent = {     parent, currentChildSnapshot -> NSDiffableDataSourceSectionSnapshot<String> in          // Return child snapshot for the parent, or just currentChildSnapshot }

## See Also

### Supporting expanding and collapsing

- [UICollectionViewDiffableDataSource.SectionSnapshotHandlers](uikit/uicollectionviewdiffabledatasource-9tqpa/sectionsnapshothandlers-swift.struct.md)
