mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-24 18:31:41 +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,
|
!self.isPendingRefetch || Thread.isMainThread,
|
||||||
"Attempted to access a \(cs_typeName(self)) outside the main thread while a refetch is in progress."
|
"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 (self.fetchedResultsController.fetchedObjects as NSArray?)?.count ?? 0
|
||||||
|
|
||||||
return numberOfObjects + sectionInfo.numberOfObjects
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user