title: [[WWDC 2020]]: Advances in Diffable Data Sources --- title: [[WWDC 2020]]: Advances in Diffable Data Sources --- - **Metadata**: - **Date:** [[June 23rd, 2020]] - **Conference:** [[WWDC 2020]] - **Speaker(s):** [[Steve Breen]] - **Video:** - **Slides:** - **Tags:** **#Talks** - [[Diffable Data Source]] - Simplfied UI state - Automatic animations - No more batch updates - [[Section Snapshots]] - Data for a single section in a `UICollectionView` - Allow data sources to be more composable - Hierarchical Data - `NSDiffableDataSourceSectionSnapshot<Item: Hashable>` - Use `append(_ parent:)` to add content - `apply` has a new version that takes a section snapsohot - and they added a getter as well - Expanding and collapsing - `expand` - `collapse` - `isExpanded` - Expansion state changes - SectionSnahotHandlers - `shouldExpandItem` - `willExpandItem` - `shouldCollapseItems` - `willCollpaseItems` - `snapshotForExpandingParent` - Performance - First Class Reordering Support - Automatic Snapshot updates - Transactions - `NSDiffableDataSourceTransaction` - initial - final - difference - sectionTransactions - `NSDiffableDataSourceSectionTrasaction` - initial` - final - difference - `dataSource.reorderingHandlers.didReorder = apply the differences` - Sample App: EmojiExplore