DataStack
public final class DataStack : Equatable
extension DataStack: CustomDebugStringConvertible, CoreStoreDebugStringConvertible
extension DataStack: FetchableSource, QueryableSource
The DataStack encapsulates the data model for the Core Data stack. Each DataStack can have multiple data stores, usually specified as a “Configuration” in the model editor. Behind the scenes, the DataStack manages its own NSPersistentStoreCoordinator, a root NSManagedObjectContext for disk saves, and a shared NSManagedObjectContext designed as a read-only model interface for NSManagedObjects.
-
The resolved application name, used by the
DataStackas the default Xcode model name (.xcdatamodel filename) if not explicitly provided.Declaration
Swift
public static let applicationName: String -
Convenience initializer for
DataStackthat creates aSchemaHistoryfrom the model with the specifiedmodelNamein the specifiedbundle.Declaration
Swift
public convenience init( xcodeModelName: XcodeDataModelFileName = DataStack.applicationName, bundle: Bundle = Bundle.main, migrationChain: MigrationChain = nil )Parameters
xcodeModelNamethe name of the (.xcdatamodeld) model file. If not specified, the application name (CFBundleName) will be used if it exists, or “CoreData” if it the bundle name was not set (e.g. in Unit Tests).
bundlean optional bundle to load .xcdatamodeld models from. If not specified, the main bundle will be used.
migrationChainthe
MigrationChainthat indicates the sequence of model versions to be used as the order for progressive migrations. If not specified, will default to a non-migrating data stack. -
Convenience initializer for
DataStackthat creates aSchemaHistoryfrom a list ofDynamicSchemaversions.CoreStoreDefaults.dataStack = DataStack( XcodeDataModelSchema(modelName: "MyModelV1"), CoreStoreSchema( modelVersion: "MyModelV2", entities: [ Entity<Animal>("Animal"), Entity<Person>("Person") ] ), migrationChain: ["MyModelV1", "MyModelV2"] )Declaration
Swift
public convenience init( _ schema: DynamicSchema, _ otherSchema: DynamicSchema..., migrationChain: MigrationChain = nil )Parameters
schemaan instance of
DynamicSchemaotherSchemaa list of other
DynamicSchemainstances that represent present/previous/future model versions, in any ordermigrationChainthe
MigrationChainthat indicates the sequence of model versions to be used as the order for progressive migrations. If not specified, will default to a non-migrating data stack. -
Initializes a
DataStackfrom aSchemaHistoryinstance.CoreStoreDefaults.dataStack = DataStack( schemaHistory: SchemaHistory( XcodeDataModelSchema(modelName: "MyModelV1"), CoreStoreSchema( modelVersion: "MyModelV2", entities: [ Entity<Animal>("Animal"), Entity<Person>("Person") ] ), migrationChain: ["MyModelV1", "MyModelV2"] ) )Declaration
Swift
public required init( schemaHistory: SchemaHistory )Parameters
schemaHistorythe
SchemaHistoryfor the stack -
Returns the
DataStack‘s current model version.StorageInterfaces added to the stack will be migrated to this version.Declaration
Swift
public var modelVersion: String { get } -
Returns the
DataStack‘s current model schema.StorageInterfaces added to the stack will be migrated to this version.Declaration
Swift
public var modelSchema: DynamicSchema { get } -
Returns the entity name-to-class type mapping from the
DataStack‘s model.Declaration
Swift
public func entityTypesByName( for type: NSManagedObject.Type ) -> [EntityName: NSManagedObject.Type] -
Returns the entity name-to-class type mapping from the
DataStack‘s model.Declaration
Swift
public func entityTypesByName( for type: CoreStoreObject.Type ) -> [EntityName: CoreStoreObject.Type] -
Returns the
NSEntityDescriptionfor the specifiedNSManagedObjectsubclass.Declaration
Swift
public func entityDescription( for type: NSManagedObject.Type ) -> NSEntityDescription? -
Returns the
NSEntityDescriptionfor the specifiedCoreStoreObjectsubclass.Declaration
Swift
public func entityDescription( for type: CoreStoreObject.Type ) -> NSEntityDescription? -
Returns the
NSManagedObjectIDfor the specified object URI if it exists in the persistent store.Declaration
Swift
public func objectID( forURIRepresentation url: URL ) -> NSManagedObjectID? -
Creates an
SQLiteStorewith default parameters and adds it to the stack. This method blocks until completion.try dataStack.addStorageAndWait()Throws
aCoreStoreErrorvalue indicating the failureDeclaration
Swift
@discardableResult public func addStorageAndWait() throws -> SQLiteStoreReturn Value
the local SQLite storage added to the stack
-
Adds a
StorageInterfaceto the stack and blocks until completion.try dataStack.addStorageAndWait(InMemoryStore(configuration: "Config1"))Throws
aCoreStoreErrorvalue indicating the failureDeclaration
Swift
@discardableResult public func addStorageAndWait<T: StorageInterface>( _ storage: T ) throws -> TParameters
storagethe
StorageInterfaceReturn Value
the
StorageInterfaceadded to the stack -
Adds a
LocalStorageto the stack and blocks until completion.try dataStack.addStorageAndWait(SQLiteStore(configuration: "Config1"))Throws
aCoreStoreErrorvalue indicating the failureDeclaration
Swift
@discardableResult public func addStorageAndWait<T: LocalStorage>( _ storage: T ) throws -> TParameters
storagethe local storage
Return Value
the local storage added to the stack. Note that this may not always be the same instance as the parameter argument if a previous
LocalStoragewas already added at the same URL and with the same configuration. -
Prepares deinitializing the
DataStackby removing all persistent stores. This is not necessary, but can help silence SQLite warnings when actively releasing and recreatingDataStacks.Declaration
Swift
public func unsafeRemoveAllPersistentStores( completion: @escaping () -> Void = {} )Parameters
completionthe closure to execute after all persistent stores are removed
-
Prepares deinitializing the
DataStackby removing all persistent stores. This is not necessary, but can help silence SQLite warnings when actively releasing and recreatingDataStacks.Declaration
Swift
public func unsafeRemoveAllPersistentStoresAndWait()
-
Allow external libraries to store custom data in the
DataStack. App code should rarely have a need for this.enum Static { static var myDataKey: Void? } CoreStoreDefaults.dataStack.userInfo[&Static.myDataKey] = myObjectImportant
Do not use this method to store thread-sensitive data.Declaration
Swift
public let userInfo: UserInfo
-
Declaration
Swift
public static func == (lhs: DataStack, rhs: DataStack) -> Bool
-
Declaration
Swift
public var debugDescription: String { get }
-
Swift concurrency utilities for the
DataStackare exposed through this namespaceDeclaration
Swift
public var async: DataStack.AsyncNamespace { get }
-
Creates an
ObjectPublisherfor the specifiedDynamicObject. Multiple objects may then register themselves to be notified when changes are made to theDynamicObject.Declaration
Swift
public func publishObject<O>(_ object: O) -> ObjectPublisher<O> where O : DynamicObjectParameters
objectthe
DynamicObjectto observe changes fromReturn Value
an
ObjectPublisherthat broadcasts changes toobject -
Creates an
ObjectPublisherfor aDynamicObjectwith the specifiedObjectID. Multiple objects may then register themselves to be notified when changes are made to theDynamicObject.Declaration
Swift
public func publishObject<O>(_ objectID: O.ObjectID) -> ObjectPublisher<O> where O : DynamicObjectParameters
objectIDthe
ObjectIDof the object to observe changes fromReturn Value
an
ObjectPublisherthat broadcasts changes toobject -
Creates a
ListPublisherthat satisfy the specifiedFetchChainableBuilderTypebuilt from a chain of clauses.let listPublisher = dataStack.listPublisher( From<MyPersonEntity>() .where(\.age > 18) .orderBy(.ascending(\.age)) )Multiple objects may then register themselves to be notified when changes are made to the fetched results.
listPublisher.addObserver(self) { (listPublisher) in // handle changes }Declaration
Swift
public func publishList<B>(_ clauseChain: B) -> ListPublisher<B.ObjectType> where B : FetchChainableBuilderTypeParameters
clauseChaina
FetchChainableBuilderTypebuilt from a chain of clausesReturn Value
a
ListPublisherthat broadcasts changes to the fetched results -
Creates a
ListPublisherfor a sectioned list that satisfy the specifiedFetchChainableBuilderTypebuilt from a chain of clauses.let listPublisher = dataStack.listPublisher( From<MyPersonEntity>() .sectionBy(\.age, { "\($0!) years old" }) .where(\.age > 18) .orderBy(.ascending(\.age)) )Multiple objects may then register themselves to be notified when changes are made to the fetched results.
listPublisher.addObserver(self) { (listPublisher) in // handle changes }Declaration
Swift
public func publishList<B>(_ clauseChain: B) -> ListPublisher<B.ObjectType> where B : SectionMonitorBuilderTypeParameters
clauseChaina
SectionMonitorBuilderTypebuilt from a chain of clausesReturn Value
a
ListPublisherthat broadcasts changes to the fetched results -
Creates a
ListPublisherfor the specifiedFromandFetchClauses. Multiple objects may then register themselves to be notified when changes are made to the fetched results.Declaration
Swift
public func publishList<O>(_ from: From<O>, _ fetchClauses: FetchClause...) -> ListPublisher<O> where O : DynamicObjectParameters
froma
Fromclause indicating the entity typefetchClausesa series of
FetchClauseinstances for fetching the object list. AcceptsWhere,OrderBy, andTweakclauses.Return Value
a
ListPublisherthat broadcasts changes to the fetched results -
Creates a
ListPublisherfor the specifiedFromandFetchClauses. Multiple objects may then register themselves to be notified when changes are made to the fetched results.Declaration
Swift
public func publishList<O>(_ from: From<O>, _ fetchClauses: [FetchClause]) -> ListPublisher<O> where O : DynamicObjectParameters
froma
Fromclause indicating the entity typefetchClausesa series of
FetchClauseinstances for fetching the object list. AcceptsWhere,OrderBy, andTweakclauses.Return Value
a
ListPublisherthat broadcasts changes to the fetched results -
Creates a
ListPublisherfor a sectioned list that satisfy the fetch clauses. Multiple objects may then register themselves to be notified when changes are made to the fetched results.Declaration
Swift
public func publishList<O>(_ from: From<O>, _ sectionBy: SectionBy<O>, _ fetchClauses: FetchClause...) -> ListPublisher<O> where O : DynamicObjectParameters
froma
Fromclause indicating the entity typesectionBya
SectionByclause indicating the keyPath for the attribute to use when sorting the list into sections.fetchClausesa series of
FetchClauseinstances for fetching the object list. AcceptsWhere,OrderBy, andTweakclauses.Return Value
a
ListPublisherthat broadcasts changes to the fetched results -
Creates a
ListPublisherfor a sectioned list that satisfy the fetch clauses. Multiple objects may then register themselves to be notified when changes are made to the fetched results.Declaration
Swift
public func publishList<O>(_ from: From<O>, _ sectionBy: SectionBy<O>, _ fetchClauses: [FetchClause]) -> ListPublisher<O> where O : DynamicObjectParameters
froma
Fromclause indicating the entity typesectionBya
SectionByclause indicating the keyPath for the attribute to use when sorting the list into sections.fetchClausesa series of
FetchClauseinstances for fetching the object list. AcceptsWhere,OrderBy, andTweakclauses.Return Value
a
ListPublisherthat broadcasts changes to the fetched results -
Asynchronously adds a
StorageInterfaceto the stack. Migrations are also initiated by default.dataStack.addStorage( InMemoryStore(configuration: "Config1"), completion: { result in switch result { case .success(let storage): // ... case .failure(let error): // ... } } )Declaration
Swift
public func addStorage<T>(_ storage: T, completion: @escaping (SetupResult<T>) -> Void) where T : StorageInterfaceParameters
storagethe storage
completionthe closure to be executed on the main queue when the process completes, either due to success or failure. The closure’s
SetupResultargument indicates the result. Note that theStorageInterfaceassociated to theSetupResult.successmay not always be the same instance as the parameter argument if a previousStorageInterfacewas already added at the same URL and with the same configuration. -
Asynchronously adds a
LocalStorageto the stack. Migrations are also initiated by default.let migrationProgress = dataStack.addStorage( SQLiteStore(fileName: "core_data.sqlite", configuration: "Config1"), completion: { result in switch result { case .success(let storage): // ... case .failure(let error): // ... } } )Declaration
Swift
public func addStorage<T>(_ storage: T, completion: @escaping (SetupResult<T>) -> Void) -> Progress? where T : LocalStorageParameters
storagethe local storage
completionthe closure to be executed on the main queue when the process completes, either due to success or failure. The closure’s
SetupResultargument indicates the result. Note that theLocalStorageassociated to theSetupResult.successmay not always be the same instance as the parameter argument if a previousLocalStoragewas already added at the same URL and with the same configuration.Return Value
a
Progressinstance if a migration has started, ornilif either no migrations are required or if a failure occured. -
Migrates a local storage to match the
DataStack‘s managed object model version. This method does NOT add the migrated store to the data stack.Throws
aCoreStoreErrorvalue indicating the failureDeclaration
Swift
public func upgradeStorageIfNeeded<T>(_ storage: T, completion: @escaping (MigrationResult) -> Void) throws -> Progress? where T : LocalStorageParameters
storagethe local storage
completionthe closure to be executed on the main queue when the migration completes, either due to success or failure. The closure’s
MigrationResultargument indicates the result.Return Value
a
Progressinstance if a migration has started, ornilis no migrations are required -
Checks the migration steps required for the storage to match the
DataStack‘s managed object model version.Throws
aCoreStoreErrorvalue indicating the failureDeclaration
Swift
public func requiredMigrationsForStorage<T>(_ storage: T) throws -> [MigrationType] where T : LocalStorageParameters
storagethe local storage
Return Value
a
MigrationTypearray indicating the migration steps required for the store, or an empty array if the file does not exist yet. Otherwise, an error is thrown if either inspection of the store failed, or if no mapping model was found/inferred. -
Creates an
ObjectMonitorfor the specifiedDynamicObject. MultipleObjectObservers may then register themselves to be notified when changes are made to theDynamicObject.Declaration
Swift
public func monitorObject<O>(_ object: O) -> ObjectMonitor<O> where O : DynamicObjectParameters
objectthe
DynamicObjectto observe changes fromReturn Value
an
ObjectMonitorthat monitors changes toobject -
Creates a
ListMonitorfor a list ofDynamicObjects that satisfy the specified fetch clauses. MultipleListObservers may then register themselves to be notified when changes are made to the list.Declaration
Swift
public func monitorList<O>(_ from: From<O>, _ fetchClauses: FetchClause...) -> ListMonitor<O> where O : DynamicObjectParameters
froma
Fromclause indicating the entity typefetchClausesa series of
FetchClauseinstances for fetching the object list. AcceptsWhere,OrderBy, andTweakclauses.Return Value
a
ListMonitorinstance that monitors changes to the list -
Creates a
ListMonitorfor a list ofDynamicObjects that satisfy the specified fetch clauses. MultipleListObservers may then register themselves to be notified when changes are made to the list.Declaration
Swift
public func monitorList<O>(_ from: From<O>, _ fetchClauses: [FetchClause]) -> ListMonitor<O> where O : DynamicObjectParameters
froma
Fromclause indicating the entity typefetchClausesa series of
FetchClauseinstances for fetching the object list. AcceptsWhere,OrderBy, andTweakclauses.Return Value
a
ListMonitorinstance that monitors changes to the list -
Creates a
ListMonitorfor a list ofDynamicObjects that satisfy the specifiedFetchChainableBuilderTypebuilt from a chain of clauses.let monitor = dataStack.monitorList( From<MyPersonEntity>() .where(\.age > 18) .orderBy(.ascending(\.age)) )Declaration
Swift
public func monitorList<B>(_ clauseChain: B) -> ListMonitor<B.ObjectType> where B : FetchChainableBuilderTypeParameters
clauseChaina
FetchChainableBuilderTypebuilt from a chain of clausesReturn Value
a
ListMonitorfor a list ofDynamicObjects that satisfy the specifiedFetchChainableBuilderType -
Asynchronously creates a
ListMonitorfor a list ofDynamicObjects that satisfy the specified fetch clauses. MultipleListObservers may then register themselves to be notified when changes are made to the list. SinceNSFetchedResultsControllergreedily locks the persistent store on initial fetch, you may prefer this method instead of the synchronous counterpart to avoid deadlocks while background updates/saves are being executed.Declaration
Swift
public func monitorList<O>(createAsynchronously: @escaping (ListMonitor<O>) -> Void, _ from: From<O>, _ fetchClauses: FetchClause...) where O : DynamicObjectParameters
createAsynchronouslythe closure that receives the created
ListMonitorinstancefroma
Fromclause indicating the entity typefetchClausesa series of
FetchClauseinstances for fetching the object list. AcceptsWhere,OrderBy, andTweakclauses. -
Asynchronously creates a
ListMonitorfor a list ofDynamicObjects that satisfy the specified fetch clauses. MultipleListObservers may then register themselves to be notified when changes are made to the list. SinceNSFetchedResultsControllergreedily locks the persistent store on initial fetch, you may prefer this method instead of the synchronous counterpart to avoid deadlocks while background updates/saves are being executed.Declaration
Swift
public func monitorList<O>(createAsynchronously: @escaping (ListMonitor<O>) -> Void, _ from: From<O>, _ fetchClauses: [FetchClause]) where O : DynamicObjectParameters
createAsynchronouslythe closure that receives the created
ListMonitorinstancefroma
Fromclause indicating the entity typefetchClausesa series of
FetchClauseinstances for fetching the object list. AcceptsWhere,OrderBy, andTweakclauses. -
Asynchronously creates a
ListMonitorfor a list ofDynamicObjects that satisfy the specifiedFetchChainableBuilderTypebuilt from a chain of clauses. SinceNSFetchedResultsControllergreedily locks the persistent store on initial fetch, you may prefer this method instead of the synchronous counterpart to avoid deadlocks while background updates/saves are being executed.dataStack.monitorList( createAsynchronously: { (monitor) in self.monitor = monitor }, From<MyPersonEntity>() .where(\.age > 18) .orderBy(.ascending(\.age)) )Declaration
Swift
public func monitorList<B>(createAsynchronously: @escaping (ListMonitor<B.ObjectType>) -> Void, _ clauseChain: B) where B : FetchChainableBuilderTypeParameters
createAsynchronouslythe closure that receives the created
ListMonitorinstanceclauseChaina
FetchChainableBuilderTypebuilt from a chain of clauses -
Creates a
ListMonitorfor a sectioned list ofDynamicObjects that satisfy the specified fetch clauses. MultipleListObservers may then register themselves to be notified when changes are made to the list.Declaration
Swift
public func monitorSectionedList<O>(_ from: From<O>, _ sectionBy: SectionBy<O>, _ fetchClauses: FetchClause...) -> ListMonitor<O> where O : DynamicObjectParameters
froma
Fromclause indicating the entity typesectionBya
SectionByclause indicating the keyPath for the attribute to use when sorting the list into sections.fetchClausesa series of
FetchClauseinstances for fetching the object list. AcceptsWhere,OrderBy, andTweakclauses.Return Value
a
ListMonitorinstance that monitors changes to the list -
Creates a
ListMonitorfor a sectioned list ofDynamicObjects that satisfy the specified fetch clauses. MultipleListObservers may then register themselves to be notified when changes are made to the list.Declaration
Swift
public func monitorSectionedList<O>(_ from: From<O>, _ sectionBy: SectionBy<O>, _ fetchClauses: [FetchClause]) -> ListMonitor<O> where O : DynamicObjectParameters
froma
Fromclause indicating the entity typesectionBya
SectionByclause indicating the keyPath for the attribute to use when sorting the list into sections.fetchClausesa series of
FetchClauseinstances for fetching the object list. AcceptsWhere,OrderBy, andTweakclauses.Return Value
a
ListMonitorinstance that monitors changes to the list -
Creates a
ListMonitorfor a sectioned list ofDynamicObjects that satisfy the specifiedSectionMonitorBuilderTypebuilt from a chain of clauses.let monitor = dataStack.monitorSectionedList( From<MyPersonEntity>() .sectionBy(\.age, { "\($0!) years old" }) .where(\.age > 18) .orderBy(.ascending(\.age)) )Declaration
Swift
public func monitorSectionedList<B>(_ clauseChain: B) -> ListMonitor<B.ObjectType> where B : SectionMonitorBuilderTypeParameters
clauseChaina
SectionMonitorBuilderTypebuilt from a chain of clausesReturn Value
a
ListMonitorfor a list ofDynamicObjects that satisfy the specifiedSectionMonitorBuilderType -
Asynchronously creates a
ListMonitorfor a sectioned list ofDynamicObjects that satisfy the specified fetch clauses. MultipleListObservers may then register themselves to be notified when changes are made to the list. SinceNSFetchedResultsControllergreedily locks the persistent store on initial fetch, you may prefer this method instead of the synchronous counterpart to avoid deadlocks while background updates/saves are being executed.Declaration
Swift
public func monitorSectionedList<O>(createAsynchronously: @escaping (ListMonitor<O>) -> Void, _ from: From<O>, _ sectionBy: SectionBy<O>, _ fetchClauses: FetchClause...) where O : DynamicObjectParameters
createAsynchronouslythe closure that receives the created
ListMonitorinstancefroma
Fromclause indicating the entity typesectionBya
SectionByclause indicating the keyPath for the attribute to use when sorting the list into sections.fetchClausesa series of
FetchClauseinstances for fetching the object list. AcceptsWhere,OrderBy, andTweakclauses. -
Asynchronously creates a
ListMonitorfor a sectioned list ofDynamicObjects that satisfy the specified fetch clauses. MultipleListObservers may then register themselves to be notified when changes are made to the list. SinceNSFetchedResultsControllergreedily locks the persistent store on initial fetch, you may prefer this method instead of the synchronous counterpart to avoid deadlocks while background updates/saves are being executed.Declaration
Swift
public func monitorSectionedList<O>(createAsynchronously: @escaping (ListMonitor<O>) -> Void, _ from: From<O>, _ sectionBy: SectionBy<O>, _ fetchClauses: [FetchClause]) where O : DynamicObjectParameters
createAsynchronouslythe closure that receives the created
ListMonitorinstancefroma
Fromclause indicating the entity typesectionBya
SectionByclause indicating the keyPath for the attribute to use when sorting the list into sections.fetchClausesa series of
FetchClauseinstances for fetching the object list. AcceptsWhere,OrderBy, andTweakclauses. -
Asynchronously creates a
ListMonitorfor a sectioned list ofDynamicObjects that satisfy the specifiedSectionMonitorBuilderTypebuilt from a chain of clauses.dataStack.monitorSectionedList( createAsynchronously: { (monitor) in self.monitor = monitor }, From<MyPersonEntity>() .sectionBy(\.age, { "\($0!) years old" }) .where(\.age > 18) .orderBy(.ascending(\.age)) )Declaration
Swift
public func monitorSectionedList<B>(createAsynchronously: @escaping (ListMonitor<B.ObjectType>) -> Void, _ clauseChain: B) where B : SectionMonitorBuilderTypeParameters
createAsynchronouslythe closure that receives the created
ListMonitorinstanceclauseChaina
SectionMonitorBuilderTypebuilt from a chain of clauses
-
Fetches the
DynamicObjectinstance in theDataStack‘s context from a reference created from a transaction or from a different managed object context.Declaration
Swift
public func fetchExisting<O>(_ object: O) -> O? where O : DynamicObjectParameters
objecta reference to the object created/fetched outside the
DataStackReturn Value
the
DynamicObjectinstance if the object exists in theDataStack, ornilif not found. -
Fetches the
DynamicObjectinstance in theDataStack‘s context from anNSManagedObjectID.Declaration
Swift
public func fetchExisting<O>(_ objectID: NSManagedObjectID) -> O? where O : DynamicObjectParameters
objectIDthe
NSManagedObjectIDfor the objectReturn Value
the
DynamicObjectinstance if the object exists in theDataStack, ornilif not found. -
Fetches the
DynamicObjectinstances in theDataStack‘s context from references created from a transaction or from a different managed object context.Declaration
Swift
public func fetchExisting<O, S>(_ objects: S) -> [O] where O : DynamicObject, O == S.Element, S : SequenceParameters
objectsan array of
DynamicObjects created/fetched outside theDataStackReturn Value
the
DynamicObjectarray for objects that exists in theDataStack -
Fetches the
DynamicObjectinstances in theDataStack‘s context from a list ofNSManagedObjectID.Declaration
Swift
public func fetchExisting<O, S>(_ objectIDs: S) -> [O] where O : DynamicObject, S : Sequence, S.Element == NSManagedObjectIDParameters
objectIDsthe
NSManagedObjectIDarray for the objectsReturn Value
the
DynamicObjectarray for objects that exists in theDataStack -
Fetches the first
DynamicObjectinstance that satisfies the specifiedFetchClauses. AcceptsWhere,OrderBy, andTweakclauses.Throws
CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.Declaration
Swift
public func fetchOne<O>(_ from: From<O>, _ fetchClauses: FetchClause...) throws -> O? where O : DynamicObjectParameters
froma
Fromclause indicating the entity typefetchClausesa series of
FetchClauseinstances for the fetch request. AcceptsWhere,OrderBy, andTweakclauses.Return Value
the first
DynamicObjectinstance that satisfies the specifiedFetchClauses, ornilif no match was found -
Fetches the first
DynamicObjectinstance that satisfies the specifiedFetchClauses. AcceptsWhere,OrderBy, andTweakclauses.Throws
CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.Declaration
Swift
public func fetchOne<O>(_ from: From<O>, _ fetchClauses: [FetchClause]) throws -> O? where O : DynamicObjectParameters
froma
Fromclause indicating the entity typefetchClausesa series of
FetchClauseinstances for the fetch request. AcceptsWhere,OrderBy, andTweakclauses.Return Value
the first
DynamicObjectinstance that satisfies the specifiedFetchClauses, ornilif no match was found -
Fetches the first
DynamicObjectinstance that satisfies the specifiedFetchChainableBuilderTypebuilt from a chain of clauses.let youngestTeen = dataStack.fetchOne( From<MyPersonEntity>() .where(\.age > 18) .orderBy(.ascending(\.age)) )Throws
CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.Declaration
Swift
public func fetchOne<B>(_ clauseChain: B) throws -> B.ObjectType? where B : FetchChainableBuilderTypeParameters
clauseChaina
FetchChainableBuilderTypebuilt from a chain of clausesReturn Value
the first
DynamicObjectinstance that satisfies the specifiedFetchChainableBuilderType, ornilif no match was found -
Fetches all
DynamicObjectinstances that satisfy the specifiedFetchClauses. AcceptsWhere,OrderBy, andTweakclauses.Throws
CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.Declaration
Swift
public func fetchAll<O>(_ from: From<O>, _ fetchClauses: FetchClause...) throws -> [O] where O : DynamicObjectParameters
froma
Fromclause indicating the entity typefetchClausesa series of
FetchClauseinstances for the fetch request. AcceptsWhere,OrderBy, andTweakclauses.Return Value
all
DynamicObjectinstances that satisfy the specifiedFetchClauses, or an empty array if no match was found -
Fetches all
DynamicObjectinstances that satisfy the specifiedFetchClauses. AcceptsWhere,OrderBy, andTweakclauses.Throws
CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.Declaration
Swift
public func fetchAll<O>(_ from: From<O>, _ fetchClauses: [FetchClause]) throws -> [O] where O : DynamicObjectParameters
froma
Fromclause indicating the entity typefetchClausesa series of
FetchClauseinstances for the fetch request. AcceptsWhere,OrderBy, andTweakclauses.Return Value
all
DynamicObjectinstances that satisfy the specifiedFetchClauses, or an empty array if no match was found -
Fetches all
DynamicObjectinstances that satisfy the specifiedFetchChainableBuilderTypebuilt from a chain of clauses.let people = dataStack.fetchAll( From<MyPersonEntity>() .where(\.age > 18) .orderBy(.ascending(\.age)) )Throws
CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.Declaration
Swift
public func fetchAll<B>(_ clauseChain: B) throws -> [B.ObjectType] where B : FetchChainableBuilderTypeParameters
clauseChaina
FetchChainableBuilderTypebuilt from a chain of clausesReturn Value
all
DynamicObjectinstances that satisfy the specifiedFetchChainableBuilderType, or an empty array if no match was found -
Fetches the number of
DynamicObjects that satisfy the specifiedFetchClauses. AcceptsWhere,OrderBy, andTweakclauses.Throws
CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.Declaration
Swift
public func fetchCount<O>(_ from: From<O>, _ fetchClauses: FetchClause...) throws -> Int where O : DynamicObjectParameters
froma
Fromclause indicating the entity typefetchClausesa series of
FetchClauseinstances for the fetch request. AcceptsWhere,OrderBy, andTweakclauses.Return Value
the number of
DynamicObjects that satisfy the specifiedFetchClauses -
Fetches the number of
DynamicObjects that satisfy the specifiedFetchClauses. AcceptsWhere,OrderBy, andTweakclauses.Throws
CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.Declaration
Swift
public func fetchCount<O>(_ from: From<O>, _ fetchClauses: [FetchClause]) throws -> Int where O : DynamicObjectParameters
froma
Fromclause indicating the entity typefetchClausesa series of
FetchClauseinstances for the fetch request. AcceptsWhere,OrderBy, andTweakclauses.Return Value
the number of
DynamicObjects that satisfy the specifiedFetchClauses -
Fetches the number of
DynamicObjects that satisfy the specifiedFetchChainableBuilderTypebuilt from a chain of clauses.let numberOfAdults = dataStack.fetchCount( From<MyPersonEntity>() .where(\.age > 18) .orderBy(.ascending(\.age)) )Throws
CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.Declaration
Swift
public func fetchCount<B>(_ clauseChain: B) throws -> Int where B : FetchChainableBuilderTypeParameters
clauseChaina
FetchChainableBuilderTypebuilt from a chain of clausesReturn Value
the number of
DynamicObjects that satisfy the specifiedFetchChainableBuilderType -
Fetches the
NSManagedObjectIDfor the firstDynamicObjectthat satisfies the specifiedFetchClauses. AcceptsWhere,OrderBy, andTweakclauses.Throws
CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.Declaration
Swift
public func fetchObjectID<O>(_ from: From<O>, _ fetchClauses: FetchClause...) throws -> NSManagedObjectID? where O : DynamicObjectParameters
froma
Fromclause indicating the entity typefetchClausesa series of
FetchClauseinstances for the fetch request. AcceptsWhere,OrderBy, andTweakclauses.Return Value
the
NSManagedObjectIDfor the firstDynamicObjectthat satisfies the specifiedFetchClauses, ornilif no match was found -
Fetches the
NSManagedObjectIDfor the firstDynamicObjectthat satisfies the specifiedFetchClauses. AcceptsWhere,OrderBy, andTweakclauses.Throws
CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.Declaration
Swift
public func fetchObjectID<O>(_ from: From<O>, _ fetchClauses: [FetchClause]) throws -> NSManagedObjectID? where O : DynamicObjectParameters
froma
Fromclause indicating the entity typefetchClausesa series of
FetchClauseinstances for the fetch request. AcceptsWhere,OrderBy, andTweakclauses.Return Value
the
NSManagedObjectIDfor the firstDynamicObjectthat satisfies the specifiedFetchClauses, ornilif no match was found -
Fetches the
NSManagedObjectIDfor the firstDynamicObjectthat satisfies the specifiedFetchChainableBuilderTypebuilt from a chain of clauses.let youngestTeenID = dataStack.fetchObjectID( From<MyPersonEntity>() .where(\.age > 18) .orderBy(.ascending(\.age)) )Throws
CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.Declaration
Swift
public func fetchObjectID<B>(_ clauseChain: B) throws -> NSManagedObjectID? where B : FetchChainableBuilderTypeParameters
clauseChaina
FetchChainableBuilderTypebuilt from a chain of clausesReturn Value
the
NSManagedObjectIDfor the firstDynamicObjectthat satisfies the specifiedFetchChainableBuilderType, ornilif no match was found -
Fetches the
NSManagedObjectIDfor allDynamicObjects that satisfy the specifiedFetchClauses. AcceptsWhere,OrderBy, andTweakclauses.Throws
CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.Declaration
Swift
public func fetchObjectIDs<O>(_ from: From<O>, _ fetchClauses: FetchClause...) throws -> [NSManagedObjectID] where O : DynamicObjectParameters
froma
Fromclause indicating the entity typefetchClausesa series of
FetchClauseinstances for the fetch request. AcceptsWhere,OrderBy, andTweakclauses.Return Value
the
NSManagedObjectIDfor allDynamicObjects that satisfy the specifiedFetchClauses, or an empty array if no match was found -
Fetches the
NSManagedObjectIDfor allDynamicObjects that satisfy the specifiedFetchClauses. AcceptsWhere,OrderBy, andTweakclauses.Throws
CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.Declaration
Swift
public func fetchObjectIDs<O>(_ from: From<O>, _ fetchClauses: [FetchClause]) throws -> [NSManagedObjectID] where O : DynamicObjectParameters
froma
Fromclause indicating the entity typefetchClausesa series of
FetchClauseinstances for the fetch request. AcceptsWhere,OrderBy, andTweakclauses.Return Value
the
NSManagedObjectIDfor allDynamicObjects that satisfy the specifiedFetchClauses, or an empty array if no match was found -
Fetches the
NSManagedObjectIDfor allDynamicObjects that satisfy the specifiedFetchChainableBuilderTypebuilt from a chain of clauses.let idsOfAdults = dataStack.fetchObjectIDs( From<MyPersonEntity>() .where(\.age > 18) .orderBy(.ascending(\.age)) )Throws
CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.Declaration
Swift
public func fetchObjectIDs<B>(_ clauseChain: B) throws -> [NSManagedObjectID] where B : FetchChainableBuilderTypeParameters
clauseChaina
FetchChainableBuilderTypebuilt from a chain of clausesReturn Value
the
NSManagedObjectIDfor allDynamicObjects that satisfy the specifiedFetchChainableBuilderType, or an empty array if no match was found
-
Queries aggregate values as specified by the
QueryClauses. Requires at least aSelectclause, and optionalWhere,OrderBy,GroupBy, andTweakclauses.A “query” differs from a “fetch” in that it only retrieves values already stored in the persistent store. As such, values from unsaved transactions or contexts will not be incorporated in the query result.
Throws
CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.Declaration
Swift
public func queryValue<O, U>(_ from: From<O>, _ selectClause: Select<O, U>, _ queryClauses: QueryClause...) throws -> U? where O : DynamicObject, U : QueryableAttributeTypeParameters
froma
Fromclause indicating the entity typeselectClausea
Select<U>clause indicating the properties to fetch, and with the generic type indicating the return type.queryClausesa series of
QueryClauseinstances for the query request. AcceptsWhere,OrderBy,GroupBy, andTweakclauses.Return Value
the result of the the query, or
nilif no match was found. The type of the return value is specified by the generic type of theSelect<U>parameter. -
Queries aggregate values as specified by the
QueryClauses. Requires at least aSelectclause, and optionalWhere,OrderBy,GroupBy, andTweakclauses.A “query” differs from a “fetch” in that it only retrieves values already stored in the persistent store. As such, values from unsaved transactions or contexts will not be incorporated in the query result.
Throws
CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.Declaration
Swift
public func queryValue<O, U>(_ from: From<O>, _ selectClause: Select<O, U>, _ queryClauses: [QueryClause]) throws -> U? where O : DynamicObject, U : QueryableAttributeTypeParameters
froma
Fromclause indicating the entity typeselectClausea
Select<U>clause indicating the properties to fetch, and with the generic type indicating the return type.queryClausesa series of
QueryClauseinstances for the query request. AcceptsWhere,OrderBy,GroupBy, andTweakclauses.Return Value
the result of the the query, or
nilif no match was found. The type of the return value is specified by the generic type of theSelect<U>parameter. -
Queries a property value or aggregate as specified by the
QueryChainableBuilderTypebuilt from a chain of clauses.A “query” differs from a “fetch” in that it only retrieves values already stored in the persistent store. As such, values from unsaved transactions or contexts will not be incorporated in the query result.
let averageAdultAge = dataStack.queryValue( From<MyPersonEntity>() .select(Int.self, .average(\.age)) .where(\.age > 18) )Throws
CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.Declaration
Swift
public func queryValue<B>(_ clauseChain: B) throws -> B.ResultType? where B : QueryChainableBuilderType, B.ResultType : QueryableAttributeTypeParameters
clauseChaina
QueryChainableBuilderTypeindicating the property/aggregate to fetch and the series of queries for the request.Return Value
the result of the the query as specified by the
QueryChainableBuilderType, ornilif no match was found. -
Queries a dictionary of attribute values as specified by the
QueryClauses. Requires at least aSelectclause, and optionalWhere,OrderBy,GroupBy, andTweakclauses.A “query” differs from a “fetch” in that it only retrieves values already stored in the persistent store. As such, values from unsaved transactions or contexts will not be incorporated in the query result.
Throws
CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.Declaration
Swift
public func queryAttributes<O>(_ from: From<O>, _ selectClause: Select<O, NSDictionary>, _ queryClauses: QueryClause...) throws -> [[String : Any]] where O : DynamicObjectParameters
froma
Fromclause indicating the entity typeselectClausea
Select<U>clause indicating the properties to fetch, and with the generic type indicating the return type.queryClausesa series of
QueryClauseinstances for the query request. AcceptsWhere,OrderBy,GroupBy, andTweakclauses.Return Value
the result of the the query. The type of the return value is specified by the generic type of the
Select<U>parameter. -
Queries a dictionary of attribute values as specified by the
QueryClauses. Requires at least aSelectclause, and optionalWhere,OrderBy,GroupBy, andTweakclauses.A “query” differs from a “fetch” in that it only retrieves values already stored in the persistent store. As such, values from unsaved transactions or contexts will not be incorporated in the query result.
Throws
CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.Declaration
Swift
public func queryAttributes<O>(_ from: From<O>, _ selectClause: Select<O, NSDictionary>, _ queryClauses: [QueryClause]) throws -> [[String : Any]] where O : DynamicObjectParameters
froma
Fromclause indicating the entity typeselectClausea
Select<U>clause indicating the properties to fetch, and with the generic type indicating the return type.queryClausesa series of
QueryClauseinstances for the query request. AcceptsWhere,OrderBy,GroupBy, andTweakclauses.Return Value
the result of the the query. The type of the return value is specified by the generic type of the
Select<U>parameter. -
Queries a dictionary of attribute values or as specified by the
QueryChainableBuilderTypebuilt from a chain of clauses.A “query” differs from a “fetch” in that it only retrieves values already stored in the persistent store. As such, values from unsaved transactions or contexts will not be incorporated in the query result.
let results = dataStack.queryAttributes( From<MyPersonEntity>() .select( NSDictionary.self, .attribute(\.age, as: "age"), .count(\.age, as: "numberOfPeople") ) .groupBy(\.age) ) for dictionary in results! { let age = dictionary["age"] as! Int let count = dictionary["numberOfPeople"] as! Int print("There are \(count) people who are \(age) years old." }Throws
CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.Declaration
Swift
public func queryAttributes<B>(_ clauseChain: B) throws -> [[String : Any]] where B : QueryChainableBuilderType, B.ResultType == NSDictionaryParameters
clauseChaina
QueryChainableBuilderTypeindicating the properties to fetch and the series of queries for the request.Return Value
the result of the the query as specified by the
QueryChainableBuilderType
-
The internal
NSManagedObjectContextmanaged by this instance. Using this context directly should typically be avoided, and is provided by CoreStore only for extremely specialized cases.Declaration
Swift
public func unsafeContext() -> NSManagedObjectContext
-
Combine utilities for the
DataStackare exposed through this namespaceDeclaration
Swift
public var reactive: DataStack.ReactiveNamespace { get }
-
Performs a transaction asynchronously where
NSManagedObjectorCoreStoreObjectcreates, updates, and deletes can be made. The changes are commited automatically after thetaskclosure returns. On success, the value returned from closure will be the wrapped as.success(T)in thecompletion‘sResult<T>. Any errors thrown from inside thetaskwill be reported as.failure(CoreStoreError). To cancel/rollback changes, calltry transaction.cancel(), which throws aCoreStoreError.userCancelled.Declaration
Swift
public func perform<T>( asynchronous task: @escaping (_ transaction: AsynchronousDataTransaction) throws -> T, sourceIdentifier: Any? = nil, completion: @escaping (AsynchronousDataTransaction.Result<T>) -> Void )Parameters
taskthe asynchronous closure where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent
NSManagedObjectContext.sourceIdentifieran optional value that identifies the source of this transaction. This identifier will be passed to the change notifications and callers can use it for custom handling that depends on the source.
completionthe closure executed after the save completes. The
Resultargument of the closure will either wrap the return value oftask, or any uncaught errors thrown from withintask. Cancelledtasks will be indicated by.failure(error: CoreStoreError.userCancelled). Custom errors thrown by the user will be wrapped inCoreStoreError.userError(error: Error). -
Performs a transaction asynchronously where
NSManagedObjectorCoreStoreObjectcreates, updates, and deletes can be made. The changes are commited automatically after thetaskclosure returns. On success, the value returned from closure will be the argument of thesuccessclosure. Any errors thrown from inside thetaskwill be wrapped in aCoreStoreErrorand reported in thefailureclosure. To cancel/rollback changes, calltry transaction.cancel(), which throws aCoreStoreError.userCancelled.Declaration
Swift
public func perform<T>( asynchronous task: @escaping (_ transaction: AsynchronousDataTransaction) throws -> T, sourceIdentifier: Any? = nil, success: @escaping (T) -> Void, failure: @escaping (CoreStoreError) -> Void )Parameters
taskthe asynchronous closure where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent
NSManagedObjectContext.sourceIdentifieran optional value that identifies the source of this transaction. This identifier will be passed to the change notifications and callers can use it for custom handling that depends on the source.
successthe closure executed after the save succeeds. The
Targument of the closure will be the value returned fromtask.failurethe closure executed if the save fails or if any errors are thrown within
task. Cancelledtasks will be indicated byCoreStoreError.userCancelled. Custom errors thrown by the user will be wrapped inCoreStoreError.userError(error: Error). -
Performs a transaction synchronously where
NSManagedObjectorCoreStoreObjectcreates, updates, and deletes can be made. The changes are commited automatically after thetaskclosure returns. On success, the value returned from closure will be the return value ofperform(synchronous:). Any errors thrown from inside thetaskwill be thrown fromperform(synchronous:). To cancel/rollback changes, calltry transaction.cancel(), which throws aCoreStoreError.userCancelled.Throws
aCoreStoreErrorvalue indicating the failure. Cancelledtasks will be indicated byCoreStoreError.userCancelled. Custom errors thrown by the user will be wrapped inCoreStoreError.userError(error: Error).Declaration
Swift
public func perform<T>( synchronous task: ((_ transaction: SynchronousDataTransaction) throws -> T), waitForAllObservers: Bool = true, sourceIdentifier: Any? = nil ) throws -> TParameters
taskthe synchronous non-escaping closure where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent
NSManagedObjectContext.waitForAllObserversWhen
true, this method waits for all observers to be notified of the changes before returning. This results in more predictable data update order, but may risk triggering deadlocks. Whenfalse, this method does not wait for observers to be notified of the changes before returning. This results in lower risk for deadlocks, but the updated data may not have been propagated to theDataStackafter returning. Defaults totrue.sourceIdentifieran optional value that identifies the source of this transaction. This identifier will be passed to the change notifications and callers can use it for custom handling that depends on the source.
Return Value
the value returned from
task -
Begins a non-contiguous transaction where
NSManagedObjectorCoreStoreObjectcreates, updates, and deletes can be made. This is useful for making temporary changes, such as partially filled forms.Declaration
Swift
public func beginUnsafe( supportsUndo: Bool = false, sourceIdentifier: Any? = nil ) -> UnsafeDataTransactionParameters
supportsUndoundo(),redo(), androllback()methods are only available when this parameter istrue, otherwise those method will raise an exception. Defaults tofalse. Note that turning on Undo support may heavily impact performance especially on iOS or watchOS where memory is limited.sourceIdentifieran optional value that identifies the source of this transaction. This identifier will be passed to the change notifications and callers can use it for custom handling that depends on the source.
Return Value
a
UnsafeDataTransactioninstance where creates, updates, and deletes can be made. -
Refreshes all registered objects
NSManagedObjects orCoreStoreObjects in theDataStack.Declaration
Swift
public func refreshAndMergeAllObjects()
-
A
Publisherthat emits aListSnapshotwhenever changes occur in theListPublisher.See moreSee also
DataStack.reactive.addStorage(_:)Declaration
Swift
public struct AddStoragePublisher<Storage> : Publisher where Storage : LocalStorage
-
Utility for creating an
NSFetchedResultsControllerfrom theDataStack. This is useful when anNSFetchedResultsControlleris preferred over the overhead ofListMonitors abstraction.Note
It is the caller’s responsibility to call
performFetch()on the createdNSFetchedResultsController.Declaration
Swift
@nonobjc public func createFetchedResultsController<O>(_ from: From<O>, _ sectionBy: SectionBy<O>, _ fetchClauses: FetchClause...) -> NSFetchedResultsController<O> where O : NSManagedObjectParameters
froma
Fromclause indicating the entity typesectionBya
SectionByclause indicating the keyPath for the attribute to use when sorting the list into sectionsfetchClausesa series of
FetchClauseinstances for fetching the object list. AcceptsWhere,OrderBy, andTweakclauses.Return Value
an
NSFetchedResultsControllerthat observes theDataStack -
Utility for creating an
NSFetchedResultsControllerfrom aDataStack. This is useful when anNSFetchedResultsControlleris preferred over the overhead ofListMonitors abstraction.Note
It is the caller’s responsibility to call
performFetch()on the createdNSFetchedResultsController.Declaration
Swift
@nonobjc public func createFetchedResultsController<O>(_ from: From<O>, _ sectionBy: SectionBy<O>, _ fetchClauses: [FetchClause]) -> NSFetchedResultsController<O> where O : NSManagedObjectParameters
froma
Fromclause indicating the entity typesectionBya
SectionByclause indicating the keyPath for the attribute to use when sorting the list into sectionsfetchClausesa series of
FetchClauseinstances for fetching the object list. AcceptsWhere,OrderBy, andTweakclauses.Return Value
an
NSFetchedResultsControllerthat observes theDataStack -
Utility for creating an
NSFetchedResultsControllerfrom theDataStack. This is useful when anNSFetchedResultsControlleris preferred over the overhead ofListMonitors abstraction.Note
It is the caller’s responsibility to call
performFetch()on the createdNSFetchedResultsController.Declaration
Swift
@nonobjc public func createFetchedResultsController<O>(_ from: From<O>, _ fetchClauses: FetchClause...) -> NSFetchedResultsController<O> where O : NSManagedObjectParameters
froma
Fromclause indicating the entity typefetchClausesa series of
FetchClauseinstances for fetching the object list. AcceptsWhere,OrderBy, andTweakclauses.Return Value
an
NSFetchedResultsControllerthat observes theDataStack -
Utility for creating an
NSFetchedResultsControllerfrom theDataStack. This is useful when anNSFetchedResultsControlleris preferred over the overhead ofListMonitors abstraction.Note
It is the caller’s responsibility to call
performFetch()on the createdNSFetchedResultsController.Declaration
Swift
@nonobjc public func createFetchedResultsController<O>(forDataStack dataStack: DataStack, _ from: From<O>, _ fetchClauses: [FetchClause]) -> NSFetchedResultsController<O> where O : NSManagedObjectParameters
froma
Fromclause indicating the entity typefetchClausesa series of
FetchClauseinstances for fetching the object list. AcceptsWhere,OrderBy, andTweakclauses.Return Value
an
NSFetchedResultsControllerthat observes theDataStack
View on GitHub
DataStack Class Reference