Skip to content

Instantly share code, notes, and snippets.

@iosdevie
Created May 29, 2021 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iosdevie/59a7bb15f3b8986ca5845365a445babf to your computer and use it in GitHub Desktop.
Save iosdevie/59a7bb15f3b8986ca5845365a445babf to your computer and use it in GitHub Desktop.
func updateDataSource(animated: Bool) {
var snapshot = NSDiffableDataSourceSnapshot<Section, Movies>()
snapshot.appendSections(Section.allCases)
snapshot.appendItems([Movies(name: "Inception")], toSection: .one)
snapshot.appendItems([Movies(name: "War")], toSection: .one)
snapshot.appendItems([Movies(name: "Departed")], toSection: .one)
snapshot.appendItems([Movies(name: "Departed")], toSection: .two)
dataSource.apply(snapshot, animatingDifferences: animated)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment