mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-18 15:07:00 +01:00
ManagedObjectListController demo
This commit is contained in:
@@ -34,15 +34,25 @@ public extension DataStack {
|
||||
|
||||
// MARK: Public
|
||||
|
||||
public func observeObjectList<T: NSManagedObject>(from: From<T>, _ queryClauses: FetchClause...) -> ManagedObjectListController<T> {
|
||||
public func observeObject<T: NSManagedObject>(object: T) -> ManagedObjectController<T> {
|
||||
|
||||
HardcoreData.assert(GCDQueue.Main.isCurrentExecutionContext(), "Attempted to fetch from a \(typeName(self)) outside the main queue.")
|
||||
HardcoreData.assert(GCDQueue.Main.isCurrentExecutionContext(), "Attempted to observe objects from \(typeName(self)) outside the main queue.")
|
||||
|
||||
return ManagedObjectController(
|
||||
dataStack: self,
|
||||
object: object
|
||||
)
|
||||
}
|
||||
|
||||
public func observeObjectList<T: NSManagedObject>(from: From<T>, _ groupBy: GroupBy? = nil, _ queryClauses: FetchClause...) -> ManagedObjectListController<T> {
|
||||
|
||||
HardcoreData.assert(GCDQueue.Main.isCurrentExecutionContext(), "Attempted to observe objects from \(typeName(self)) outside the main queue.")
|
||||
|
||||
// TODO: sectionNameKeyPath and cacheResults
|
||||
return ManagedObjectListController(
|
||||
dataStack: self,
|
||||
entity: T.self,
|
||||
sectionNameKeyPath: nil,
|
||||
sectionNameKeyPath: groupBy?.keyPaths.first,
|
||||
cacheResults: false,
|
||||
queryClauses: queryClauses
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user