mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-15 05:33:31 +01:00
[ListMonitor] [numberOfObjects()] Return count of fetchedObjects.
Casting `fetchedObjects` to `NSArray?` has better performance. https://github.com/JohnEstropia/CoreStore/pull/288
This commit is contained in:
@@ -232,10 +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.sections().reduce(0, { (numberOfObjects, sectionInfo) -> Int in
|
||||
|
||||
return numberOfObjects + sectionInfo.numberOfObjects
|
||||
})
|
||||
return (self.fetchedResultsController.fetchedObjects as NSArray?)?.count ?? 0
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user