FetchableSource
public protocol FetchableSource : AnyObjectEncapsulates containers which manages an internal NSManagedObjectContext, such as DataStacks and transactions, that can be used for fetching objects. CoreStore provides implementations for this protocol and should be used as a read-only abstraction.
- 
                  
                  Fetches the DynamicObjectinstance in theFetchableSource‘s context from a reference created from another managed object context.DeclarationSwift func fetchExisting<O>(_ object: O) -> O? where O : DynamicObjectParametersobjecta reference to the object created/fetched outside the FetchableSource‘s contextReturn Valuethe DynamicObjectinstance if the object exists in theFetchableSource‘s context, ornilif not found.
- 
                  
                  Fetches the DynamicObjectinstance in theFetchableSource‘s context from anNSManagedObjectID.DeclarationSwift func fetchExisting<O>(_ objectID: NSManagedObjectID) -> O? where O : DynamicObjectParametersobjectIDthe NSManagedObjectIDfor the objectReturn Valuethe DynamicObjectinstance if the object exists in theFetchableSource, ornilif not found.
- 
                  
                  Fetches the DynamicObjectinstances in theFetchableSource‘s context from references created from another managed object context.DeclarationSwift func fetchExisting<O, S>(_ objects: S) -> [O] where O : DynamicObject, O == S.Element, S : SequenceParametersobjectsan array of DynamicObjects created/fetched outside theFetchableSource‘s contextReturn Valuethe DynamicObjectarray for objects that exists in theFetchableSource
- 
                  
                  Fetches the DynamicObjectinstances in theFetchableSource‘s context from a list ofNSManagedObjectID.DeclarationSwift func fetchExisting<O, S>(_ objectIDs: S) -> [O] where O : DynamicObject, S : Sequence, S.Element == NSManagedObjectIDParametersobjectIDsthe NSManagedObjectIDarray for the objectsReturn Valuethe DynamicObjectarray for objects that exists in theFetchableSource‘s context
- 
                  
                  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.DeclarationSwift func fetchOne<O>(_ from: From<O>, _ fetchClauses: FetchClause...) throws -> O? where O : DynamicObjectParametersfroma Fromclause indicating the entity typefetchClausesa series of FetchClauseinstances for the fetch request. AcceptsWhere,OrderBy, andTweakclauses.Return Valuethe 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.DeclarationSwift func fetchOne<O>(_ from: From<O>, _ fetchClauses: [FetchClause]) throws -> O? where O : DynamicObjectParametersfroma Fromclause indicating the entity typefetchClausesa series of FetchClauseinstances for the fetch request. AcceptsWhere,OrderBy, andTweakclauses.Return Valuethe 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 = source.fetchOne( From<MyPersonEntity>() .where(\.age > 18) .orderBy(.ascending(\.age)) )Throws CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.DeclarationSwift func fetchOne<B>(_ clauseChain: B) throws -> B.ObjectType? where B : FetchChainableBuilderTypeParametersclauseChaina FetchChainableBuilderTypebuilt from a chain of clausesReturn Valuethe 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.DeclarationSwift func fetchAll<O>(_ from: From<O>, _ fetchClauses: FetchClause...) throws -> [O] where O : DynamicObjectParametersfroma Fromclause indicating the entity typefetchClausesa series of FetchClauseinstances for the fetch request. AcceptsWhere,OrderBy, andTweakclauses.Return Valueall 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.DeclarationSwift func fetchAll<O>(_ from: From<O>, _ fetchClauses: [FetchClause]) throws -> [O] where O : DynamicObjectParametersfroma Fromclause indicating the entity typefetchClausesa series of FetchClauseinstances for the fetch request. AcceptsWhere,OrderBy, andTweakclauses.Return Valueall 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 = source.fetchAll( From<MyPersonEntity>() .where(\.age > 18) .orderBy(.ascending(\.age)) )Throws CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.DeclarationSwift func fetchAll<B>(_ clauseChain: B) throws -> [B.ObjectType] where B : FetchChainableBuilderTypeParametersclauseChaina FetchChainableBuilderTypebuilt from a chain of clausesReturn Valueall 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.DeclarationSwift func fetchCount<O>(_ from: From<O>, _ fetchClauses: FetchClause...) throws -> Int where O : DynamicObjectParametersfroma Fromclause indicating the entity typefetchClausesa series of FetchClauseinstances for the fetch request. AcceptsWhere,OrderBy, andTweakclauses.Return Valuethe 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.DeclarationSwift func fetchCount<O>(_ from: From<O>, _ fetchClauses: [FetchClause]) throws -> Int where O : DynamicObjectParametersfroma Fromclause indicating the entity typefetchClausesa series of FetchClauseinstances for the fetch request. AcceptsWhere,OrderBy, andTweakclauses.Return Valuethe number of DynamicObjects that satisfy the specifiedFetchClauses
- 
                  
                  Fetches the number of DynamicObjects that satisfy the specifiedFetchChainableBuilderTypebuilt from a chain of clauses.let numberOfAdults = source.fetchCount( From<MyPersonEntity>() .where(\.age > 18) .orderBy(.ascending(\.age)) )Throws CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.DeclarationSwift func fetchCount<B>(_ clauseChain: B) throws -> Int where B : FetchChainableBuilderTypeParametersclauseChaina FetchChainableBuilderTypebuilt from a chain of clausesReturn Valuethe 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.DeclarationSwift func fetchObjectID<O>(_ from: From<O>, _ fetchClauses: FetchClause...) throws -> NSManagedObjectID? where O : DynamicObjectParametersfroma Fromclause indicating the entity typefetchClausesa series of FetchClauseinstances for the fetch request. AcceptsWhere,OrderBy, andTweakclauses.Return Valuethe 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.DeclarationSwift func fetchObjectID<O>(_ from: From<O>, _ fetchClauses: [FetchClause]) throws -> NSManagedObjectID? where O : DynamicObjectParametersfroma Fromclause indicating the entity typefetchClausesa series of FetchClauseinstances for the fetch request. AcceptsWhere,OrderBy, andTweakclauses.Return Valuethe 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 = source.fetchObjectID( From<MyPersonEntity>() .where(\.age > 18) .orderBy(.ascending(\.age)) )Throws CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.DeclarationSwift func fetchObjectID<B>(_ clauseChain: B) throws -> NSManagedObjectID? where B : FetchChainableBuilderTypeParametersclauseChaina FetchChainableBuilderTypebuilt from a chain of clausesReturn Valuethe 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.DeclarationSwift func fetchObjectIDs<O>(_ from: From<O>, _ fetchClauses: FetchClause...) throws -> [NSManagedObjectID] where O : DynamicObjectParametersfroma Fromclause indicating the entity typefetchClausesa series of FetchClauseinstances for the fetch request. AcceptsWhere,OrderBy, andTweakclauses.Return Valuethe 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.DeclarationSwift func fetchObjectIDs<O>(_ from: From<O>, _ fetchClauses: [FetchClause]) throws -> [NSManagedObjectID] where O : DynamicObjectParametersfroma Fromclause indicating the entity typefetchClausesa series of FetchClauseinstances for the fetch request. AcceptsWhere,OrderBy, andTweakclauses.Return Valuethe 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 = source.fetchObjectIDs( From<MyPersonEntity>() .where(\.age > 18) .orderBy(.ascending(\.age)) )Throws CoreStoreError.persistentStoreNotFoundif the specified entity could not be found in any store’s schema.DeclarationSwift func fetchObjectIDs<B>(_ clauseChain: B) throws -> [NSManagedObjectID] where B : FetchChainableBuilderTypeParametersclauseChaina FetchChainableBuilderTypebuilt from a chain of clausesReturn Valuethe NSManagedObjectIDfor allDynamicObjects that satisfy the specifiedFetchChainableBuilderType, or an empty array if no match was found
- 
                  
                  The internal NSManagedObjectContextmanaged by thisFetchableSource. Using this context directly should typically be avoided, and is provided by CoreStore only for extremely specialized cases.DeclarationSwift func unsafeContext() -> NSManagedObjectContext
 View on GitHub
            View on GitHub
           FetchableSource Protocol Reference
      FetchableSource Protocol Reference