<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: -",
    "tvOS: 14.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UICollectionViewDiffableDataSource-9tqpa/SectionSnapshotHandlers-swift.struct/snapshotForExpandingParent",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "s:5UIKit34UICollectionViewDiffableDataSourceC23SectionSnapshotHandlersV26snapshotForExpandingParentAA010NSDiffableefgH0Vyqd__Gqd___AItcSgvp"
  },
  "title" : "snapshotForExpandingParent"
}
-->

# snapshotForExpandingParent

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

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

## Discussion

Use the [`snapshotForExpandingParent`](/documentation/UIKit/UICollectionViewDiffableDataSource-9tqpa/SectionSnapshotHandlers-swift.struct/snapshotForExpandingParent) handler to customize the snapshot that returns when a particular parent item is expanded.

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)