Add utility for DiffableDataSources to create an empty snapshot for custom list construction

This commit is contained in:
John Estropia
2021-06-16 23:28:46 +09:00
parent 798d30bbd9
commit 4534bc06f5

View File

@@ -154,6 +154,17 @@ extension DiffableDataSource {
completion: completion
)
}
/**
Creates a new empty `ListSnapshot` suitable for building custom lists inside subclass implementations of `apply(_:animatingDifferences:completion:)`.
*/
public func makeEmptySnapshot() -> ListSnapshot<O> {
return .init(
diffableSnapshot: .init(),
context: self.dataStack.unsafeContext()
)
}
/**
Returns the number of sections