Support for fetchOffset in ListPublisher, optimize slicing logic

This commit is contained in:
John Estropia
2019-11-18 19:52:57 +09:00
parent b1decc9853
commit 4ee1b04523
2 changed files with 44 additions and 26 deletions

View File

@@ -91,13 +91,10 @@ extension Internals {
dynamic func controllerDidChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
var snapshot = Internals.DiffableDataSourceSnapshot(
sections: controller.sections ?? []
sections: controller.sections ?? [],
fetchOffset: controller.fetchRequest.fetchOffset,
fetchLimit: controller.fetchRequest.fetchLimit
)
let fetchLimit = controller.fetchRequest.fetchLimit
if fetchLimit > 0 {
snapshot.resize(limit: fetchLimit)
}
snapshot.reloadSections(self.reloadedSectionIDs)
snapshot.reloadItems(self.reloadedItemIDs)