From a4d2f326a5b2480d6f1ae5e0910c597d19e88569 Mon Sep 17 00:00:00 2001 From: John Estropia Date: Mon, 28 Jan 2019 20:12:18 +0900 Subject: [PATCH] Improve perfomance by bypassing bridging (similar to https://github.com/JohnEstropia/CoreStore/pull/288) --- Sources/ListMonitor.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/ListMonitor.swift b/Sources/ListMonitor.swift index 4888629..05363fe 100644 --- a/Sources/ListMonitor.swift +++ b/Sources/ListMonitor.swift @@ -90,7 +90,7 @@ public final class ListMonitor: Hashable { ) if self.isSectioned { - return ObjectType.cs_fromRaw(object: self.fetchedResultsController.fetchedObjects![index]) + return ObjectType.cs_fromRaw(object: (self.fetchedResultsController.fetchedObjects as NSArray?)![index] as! NSManagedObject) } return self[0, index] } @@ -105,10 +105,10 @@ public final class ListMonitor: Hashable { if self.isSectioned { - let fetchedObjects = self.fetchedResultsController.fetchedObjects! + let fetchedObjects = (self.fetchedResultsController.fetchedObjects as NSArray?)! if index < fetchedObjects.count && index >= 0 { - return ObjectType.cs_fromRaw(object: fetchedObjects[index]) + return ObjectType.cs_fromRaw(object: fetchedObjects[index] as! NSManagedObject) } return nil } @@ -353,7 +353,7 @@ public final class ListMonitor: Hashable { ) if self.isSectioned { - return self.fetchedResultsController.fetchedObjects?.index(of: object.cs_toRaw()) + return (self.fetchedResultsController.fetchedObjects as NSArray?)?.index(of: object.cs_toRaw()) } return self.fetchedResultsController.indexPath(forObject: object.cs_toRaw())?[1] }