diff --git a/CoreStore/Observing/ListMonitor.swift b/CoreStore/Observing/ListMonitor.swift index fd0f540..d0c5bf5 100644 --- a/CoreStore/Observing/ListMonitor.swift +++ b/CoreStore/Observing/ListMonitor.swift @@ -891,6 +891,7 @@ public final class ListMonitor { object: self ) } + self.fetchClauses = fetchClauses self.taskGroup.notify(.Main) { [weak self] () -> Void in @@ -902,7 +903,7 @@ public final class ListMonitor { strongSelf.fetchedResultsControllerDelegate.enabled = false let fetchRequest = strongSelf.fetchedResultsController.fetchRequest - for clause in fetchClauses { + for clause in strongSelf.fetchClauses { clause.applyToFetchRequest(fetchRequest) } @@ -1019,6 +1020,7 @@ public final class ListMonitor { self.sectionIndexTransformer = { $0 } } self.transactionQueue = transactionQueue + self.fetchClauses = fetchClauses fetchedResultsControllerDelegate.handler = self fetchedResultsControllerDelegate.fetchedResultsController = fetchedResultsController @@ -1045,7 +1047,7 @@ public final class ListMonitor { return } - self.refetch(fetchClauses) + self.refetch(self.fetchClauses) } ) @@ -1068,7 +1070,7 @@ public final class ListMonitor { if previousStores != currentStores { - self.refetch(fetchClauses) + self.refetch(self.fetchClauses) } } @@ -1130,6 +1132,7 @@ public final class ListMonitor { private var observerForDidChangePersistentStore: NotificationObserver! private let taskGroup = GCDGroup() private let transactionQueue: GCDQueue + private var fetchClauses: [FetchClause] private var willChangeListKey: Void? private var didChangeListKey: Void?