Skip to content

Instantly share code, notes, and snippets.

@michzio
Created May 3, 2020 10:21
Show Gist options
  • Save michzio/cd9d4edae34643a07d969e44d81f4d2e to your computer and use it in GitHub Desktop.
Save michzio/cd9d4edae34643a07d969e44d81f4d2e to your computer and use it in GitHub Desktop.
extension CollectionView {
private func snapshotForCurrentState() -> NSDiffableDataSourceSnapshot<Section, Item> {
var snapshot = NSDiffableDataSourceSnapshot<Section, Item>()
snapshot.appendSections(sections)
for section in sections {
snapshot.appendItems(items[section]!, toSection: section)
}
return snapshot
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment