Merge pull request #288 from ruslanskorb/list-monitor-number-of-objects-performance

[ListMonitor] Fix performance of `numberOfObjects()`.
This commit is contained in:
John Estropia
2018-12-06 18:53:06 +09:00
committed by GitHub

View File

@@ -232,7 +232,7 @@ public final class ListMonitor<D: DynamicObject>: Hashable {
!self.isPendingRefetch || Thread.isMainThread,
"Attempted to access a \(cs_typeName(self)) outside the main thread while a refetch is in progress."
)
return self.fetchedResultsController.fetchedObjects?.count ?? 0
return (self.fetchedResultsController.fetchedObjects as NSArray?)?.count ?? 0
}
/**