Number of section, Number of items 2. Cell For Items/Row 3. Size For Item (optional after automatic dimensions) The Table View/Collection View handles the presentation on screen.
Cell UI • Rapid Iteration • Flexible ◦ Freedom to choose how to store the backing data ◦ Decoupled from rest of the view layout logic ◦ Support for Multiple sections
models provide unique hashable identifiers 2. Create a Diffable Data source and map it to your Collection View / TableView Use 1. Create a snapshot 2. Populate the Snapshot with section and Item identifiers 3. Apply the snapshot.
2. Create a Diffable Data source and map it to your Collection View / TableView Use 1. Create a snapShot 2. Populate the Snapshot with section and Item identifiers 3. Apply the snapshot.
append, insert, delete etc • Edit it safely (its a copy) What All can you do with a snap shot ? API reference : https://developer.apple.com/documentation/uikit/nsdiffabledatasourcesnapshotreference
operations on it ◦ snapShot.insertSections([SectionId], beforeSection: SectionID) • How to interact with indexPath api ◦ dataSource.itemIdentifier(for:indexPath)
Open source to the rescue ◦ DiffableDataSource [https://github.com/ra1028/DiffableDataSources] ◦ Difference kit [https://github.com/ra1028/DifferenceKit] ◦ Differ [https://github.com/tonyarnold/Differ]
single centralized source of truth ◦ No performBatchupdates() only apply() • Works with SnapShots and Identifiers not indexpaths • Operation on Snapshot • Backward compatibility More Info: https://developer.apple.com/videos/play/wwdc2019/220/ https://jayeshkawli.ghost.io/ios-13-diffable-data-source-for-uitableview-and-uicollectionview/ https://developer.apple.com/documentation/uikit/nsdiffabledatasourcesnapshotreference