---
title: snapshotForExpandingParent
framework: uikit
role: symbol
role_heading: Instance Property
path: uikit/uicollectionviewdiffabledatasource-9tqpa/sectionsnapshothandlers-swift.struct/snapshotforexpandingparent
---

# snapshotForExpandingParent

The handler that provides the section snapshot for expanding the parent item.

## Declaration

```swift
var snapshotForExpandingParent: ((ItemIdentifierType, NSDiffableDataSourceSectionSnapshot<ItemIdentifierType>) -> NSDiffableDataSourceSectionSnapshot<ItemIdentifierType>)? { get set }
```

## Discussion

Discussion 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, existingSnapshot -> NSDiffableDataSourceSectionSnapshot<String> in          // Return child snapshot for the parent, or just existingSnapshot }

## See Also

### Expanding and collapsing items

- [shouldCollapseItem](uikit/uicollectionviewdiffabledatasource-9tqpa/sectionsnapshothandlers-swift.struct/shouldcollapseitem.md)
- [shouldExpandItem](uikit/uicollectionviewdiffabledatasource-9tqpa/sectionsnapshothandlers-swift.struct/shouldexpanditem.md)
- [willCollapseItem](uikit/uicollectionviewdiffabledatasource-9tqpa/sectionsnapshothandlers-swift.struct/willcollapseitem.md)
- [willExpandItem](uikit/uicollectionviewdiffabledatasource-9tqpa/sectionsnapshothandlers-swift.struct/willexpanditem.md)
