snapshotForExpandingParent
The handler that provides the section snapshot for expanding the parent item.
Declaration
var snapshotForExpandingParent: ((ItemIdentifierType, NSDiffableDataSourceSectionSnapshot<ItemIdentifierType>) -> NSDiffableDataSourceSectionSnapshot<ItemIdentifierType>)? { get set }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
}