mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-11-13 12:23:32 +01:00
allow accessing a ListMonitor as a flat array when using API's without section info
This commit is contained in:
1 parent
d25f751089
commit
e50dd9881d
1 file changed
+7
-2
@@ -82,7 +82,7 @@ public final class ListMonitor<T: NSManagedObject> {
|
||||
*/
|
||||
public subscript(index: Int) -> T {
|
||||
|
||||
return self[0, index]
|
||||
return self.objectsInAllSections()[index]
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,7 +93,12 @@ public final class ListMonitor<T: NSManagedObject> {
|
||||
*/
|
||||
public subscript(safeIndex index: Int) -> T? {
|
||||
|
||||
return self[safeSectionIndex: 0, safeItemIndex: index]
|
||||
let objects = self.objectsInAllSections()
|
||||
guard objects.indices.contains(index) else {
|
||||
|
||||
return nil
|
||||
}
|
||||
return objects[index]
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user