Allow purging of datasource

This commit is contained in:
John Estropia
2019-12-17 21:10:01 +09:00
parent eef1c99f11
commit 57745f36a8
7 changed files with 86 additions and 41 deletions

View File

@@ -51,6 +51,26 @@ extension Internals {
self.dataStack = dataStack
}
func purge<Target: DiffableDataSource.Target>(
target: Target?,
animatingDifferences: Bool,
performUpdates: @escaping (
Target,
StagedChangeset<[Internals.DiffableDataSourceSnapshot.Section]>,
@escaping ([Internals.DiffableDataSourceSnapshot.Section]) -> Void
) -> Void,
completion: @escaping () -> Void
) {
self.apply(
.init(),
target: target,
animatingDifferences: animatingDifferences,
performUpdates: performUpdates,
completion: completion
)
}
func apply<Target: DiffableDataSource.Target>(
_ snapshot: DiffableDataSourceSnapshot,