mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-26 03:11:30 +01:00
allow accessing a ListMonitor as a flat array when using API's without section info
This commit is contained in:
@@ -82,7 +82,7 @@ public final class ListMonitor<T: NSManagedObject> {
|
|||||||
*/
|
*/
|
||||||
public subscript(index: Int) -> T {
|
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? {
|
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