From
public struct From<O> where O : DynamicObject
extension From: CustomDebugStringConvertible, CoreStoreDebugStringConvertible
A From clause specifies the source entity and source persistent store for fetch and query methods. A common usage is to just indicate the entity:
let person = transaction.fetchOne(From<Person>())
For cases where multiple NSPersistentStores contain the same entity, the source configuration’s name needs to be specified as well:
let person = transaction.fetchOne(From<Person>("Configuration1"))
-
The associated
NSManagedObjectorCoreStoreObjectentity classDeclaration
Swift
public let entityClass: O.Type -
The
NSPersistentStoreconfiguration names to associate objects from. May containStrings to pertain to named configurations, ornilto pertain to the default configurationDeclaration
Swift
public let configurations: [ModelConfiguration]? -
Initializes a
Fromclause.let people = transaction.fetchAll(From<MyPersonEntity>())Declaration
Swift
public init() -
Initializes a
Fromclause with the specified entity type.let people = transaction.fetchAll(From<MyPersonEntity>())Declaration
Swift
public init(_ entity: O.Type)Parameters
entitythe associated
NSManagedObjectorCoreStoreObjecttype -
Initializes a
Fromclause with the specified configurations.let people = transaction.fetchAll(From<MyPersonEntity>(nil, "Configuration1"))Declaration
Swift
public init(_ configuration: ModelConfiguration, _ otherConfigurations: ModelConfiguration...)Parameters
configurationthe
NSPersistentStoreconfiguration name to associate objects from. This parameter is required if multiple configurations contain the createdNSManagedObjectorCoreStoreObject‘s entity type. Set tonilto use the default configuration.otherConfigurationsan optional list of other configuration names to associate objects from (see
configurationparameter) -
Initializes a
Fromclause with the specified configurations.let people = transaction.fetchAll(From<MyPersonEntity>(["Configuration1", "Configuration2"]))Declaration
Swift
public init(_ configurations: [ModelConfiguration])Parameters
configurationsa list of
NSPersistentStoreconfiguration names to associate objects from. This parameter is required if multiple configurations contain the createdNSManagedObjectorCoreStoreObject‘s entity type. Set tonilto use the default configuration. -
Initializes a
Fromclause with the specified configurations.let people = transaction.fetchAll(From(MyPersonEntity.self, nil, "Configuration1"))Declaration
Swift
public init(_ entity: O.Type, _ configuration: ModelConfiguration, _ otherConfigurations: ModelConfiguration...)Parameters
entitythe associated
NSManagedObjectorCoreStoreObjecttypeconfigurationthe
NSPersistentStoreconfiguration name to associate objects from. This parameter is required if multiple configurations contain the createdNSManagedObjectorCoreStoreObject‘s entity type. Set tonilto use the default configuration.otherConfigurationsan optional list of other configuration names to associate objects from (see
configurationparameter) -
Initializes a
Fromclause with the specified configurations.let people = transaction.fetchAll(From(MyPersonEntity.self, ["Configuration1", "Configuration1"]))Declaration
Swift
public init(_ entity: O.Type, _ configurations: [ModelConfiguration])Parameters
entitythe associated
NSManagedObjectorCoreStoreObjecttypeconfigurationsa list of
NSPersistentStoreconfiguration names to associate objects from. This parameter is required if multiple configurations contain the createdNSManagedObjectorCoreStoreObject‘s entity type. Set tonilto use the default configuration.
-
Declaration
Swift
public var debugDescription: String { get }
-
Creates a
FetchChainBuilderthat starts with the specifiedWhereclauseDeclaration
Swift
public func `where`(_ clause: Where<O>) -> FetchChainBuilder<O>Parameters
clausethe
Whereclause to create aFetchChainBuilderwithReturn Value
a
FetchChainBuilderthat starts with the specifiedWhereclause -
Creates a
FetchChainBuilderthatANDs the specifiedWhereclauses. Use this overload if the compiler cannot infer the types when chaining multiple&&operators.Declaration
Swift
public func `where`(combineByAnd clauses: Where<O>...) -> FetchChainBuilder<O>Parameters
clausesthe
Whereclauses to create aFetchChainBuilderwithReturn Value
a
FetchChainBuilderthatANDs the specifiedWhereclauses -
Creates a
FetchChainBuilderthatORs the specifiedWhereclauses. Use this overload if the compiler cannot infer the types when chaining multiple||operators.Declaration
Swift
public func `where`(combineByOr clauses: Where<O>...) -> FetchChainBuilder<O>Parameters
clausesthe
Whereclauses to create aFetchChainBuilderwithReturn Value
a
FetchChainBuilderthatORs the specifiedWhereclauses -
Creates a
FetchChainBuilderwith a predicate using the specified string format and argumentsDeclaration
Swift
public func `where`( format: String, _ args: Any... ) -> FetchChainBuilder<O>Parameters
formatthe format string for the predicate
argsthe arguments for
formatReturn Value
a
FetchChainBuilderwith a predicate using the specified string format and arguments -
Creates a
FetchChainBuilderwith a predicate using the specified string format and argumentsDeclaration
Swift
public func `where`( format: String, argumentArray: [Any]? ) -> FetchChainBuilder<O>Parameters
formatthe format string for the predicate
argumentArraythe arguments for
formatReturn Value
a
FetchChainBuilderwith a predicate using the specified string format and arguments -
Creates a
FetchChainBuilderthat starts with the specifiedOrderByclause.Declaration
Swift
public func orderBy(_ clause: OrderBy<O>) -> FetchChainBuilder<O>Parameters
clausethe
OrderByclause to create aFetchChainBuilderwithReturn Value
a
FetchChainBuilderthat starts with the specifiedOrderByclause -
Creates a
FetchChainBuilderwith a series ofSortKeysDeclaration
Swift
public func orderBy( _ sortKey: OrderBy<O>.SortKey, _ sortKeys: OrderBy<O>.SortKey... ) -> FetchChainBuilder<O>Parameters
sortKeya single
SortKeysortKeysa series of other
SortKeysReturn Value
a
FetchChainBuilderwith a series ofSortKeys -
Creates a
FetchChainBuilderwith a series ofSortKeysDeclaration
Swift
public func orderBy(_ sortKeys: [OrderBy<O>.SortKey]) -> FetchChainBuilder<O>Parameters
sortKeysa series of
SortKeysReturn Value
a
FetchChainBuilderwith a series ofSortKeys -
Creates a
FetchChainBuilderwith a closure where theNSFetchRequestmay be configuredDeclaration
Swift
public func tweak(_ fetchRequest: @escaping (NSFetchRequest<NSFetchRequestResult>) -> Void) -> FetchChainBuilder<O>Parameters
fetchRequestthe block to customize the
NSFetchRequestReturn Value
a
FetchChainBuilderwith closure where theNSFetchRequestmay be configured -
Creates a
FetchChainBuilderand immediately appending aFetchClauseDeclaration
Swift
public func appending(_ clause: FetchClause) -> FetchChainBuilder<O>Parameters
clausethe
FetchClauseto add to theFetchChainBuilderReturn Value
a
FetchChainBuildercontaining the specifiedFetchClause -
Creates a
FetchChainBuilderand immediately appending a series ofFetchClausesDeclaration
Swift
public func appending<S>(contentsOf clauses: S) -> FetchChainBuilder<O> where S : Sequence, S.Element == FetchClauseParameters
clausesthe
FetchClauses to add to theFetchChainBuilderReturn Value
a
FetchChainBuildercontaining the specifiedFetchClauses -
Creates a
QueryChainBuilderthat starts with the specifiedSelectclauseDeclaration
Swift
public func select<R>(_ clause: Select<O, R>) -> QueryChainBuilder<O, R> where R : SelectResultTypeParameters
clausethe
Selectclause to create aQueryChainBuilderwithReturn Value
a
QueryChainBuilderthat starts with the specifiedSelectclause -
Creates a
QueryChainBuilderthat starts with aSelectclause created from the specifiedSelectTermsDeclaration
Swift
public func select<R>( _ resultType: R.Type, _ selectTerm: SelectTerm<O>, _ selectTerms: SelectTerm<O>... ) -> QueryChainBuilder<O, R>Parameters
resultTypethe generic
SelectResultTypefor theSelectclauseselectTermselectTermsa series of
SelectTermsReturn Value
a
QueryChainBuilderthat starts with aSelectclause created from the specifiedSelectTerms -
Creates a
QueryChainBuilderthat starts with aSelectclause created from the specifiedSelectTermsDeclaration
Swift
public func select<R>( _ resultType: R.Type, _ selectTerms: [SelectTerm<O>] ) -> QueryChainBuilder<O, R>Parameters
resultTypethe generic
SelectResultTypefor theSelectclauseselectTermsa series of
SelectTermsReturn Value
a
QueryChainBuilderthat starts with aSelectclause created from the specifiedSelectTerms -
Creates a
SectionMonitorChainBuilderthat starts with theSectionByto use to groupListMonitorobjects into sectionsDeclaration
Swift
public func sectionBy(_ clause: SectionBy<O>) -> SectionMonitorChainBuilder<O>Parameters
clausethe
SectionByto be used by theListMonitorReturn Value
a
SectionMonitorChainBuilderthat is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilderwith the key path to use to groupListMonitorobjects into sectionsDeclaration
Swift
public func sectionBy(_ sectionKeyPath: KeyPathString) -> SectionMonitorChainBuilder<O>Parameters
sectionKeyPaththe key path to use to group the objects into sections
Return Value
a
SectionMonitorChainBuilderthat is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilderwith the key path to use to groupListMonitorobjects into sections, and a closure to transform the value for the key path to an appropriate section index titleImportant
Some utilities (such asListMonitors) may keepSectionBys in memory and may thus introduce retain cycles if reference captures are not handled properly.Declaration
Swift
public func sectionBy( _ sectionKeyPath: KeyPathString, sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? ) -> SectionMonitorChainBuilder<O>Parameters
sectionKeyPaththe key path to use to group the objects into sections
sectionIndexTransformera closure to transform the value for the key path to an appropriate section index title
Return Value
a
SectionMonitorChainBuilderthat is sectioned by the specified key path
-
Creates a
QueryChainBuilderthat starts with aSelectclause created from the specified key pathDeclaration
Swift
public func select<R>(_ keyPath: KeyPath<O, R>) -> QueryChainBuilder<O, R> where R : SelectResultTypeParameters
keyPaththe keyPath to query the value for
Return Value
a
QueryChainBuilderthat starts with aSelectclause created from the specified key path -
Creates a
SectionMonitorChainBuilderwith the key path to use to groupListMonitorobjects into sectionsDeclaration
Swift
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, T>) -> SectionMonitorChainBuilder<O>Parameters
sectionKeyPaththe
KeyPathto use to group the objects into sectionsReturn Value
a
SectionMonitorChainBuilderthat is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilderwith the key path to use to groupListMonitorobjects into sections, and a closure to transform the value for the key path to an appropriate section index titleImportant
Some utilities (such asListMonitors) may keepSectionBys in memory and may thus introduce retain cycles if reference captures are not handled properly.Declaration
Swift
public func sectionBy<T>( _ sectionKeyPath: KeyPath<O, T>, sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? ) -> SectionMonitorChainBuilder<O>Parameters
sectionKeyPaththe
KeyPathto use to group the objects into sectionssectionIndexTransformera closure to transform the value for the key path to an appropriate section index title
Return Value
a
SectionMonitorChainBuilderthat is sectioned by the specified key path
-
Creates a
FetchChainBuilderthat starts with the specifiedWhereclauseDeclaration
Swift
public func `where`<T>(_ clause: (O) -> T) -> FetchChainBuilder<O> where T : AnyWhereClauseParameters
clausea closure that returns a
WhereclauseReturn Value
a
FetchChainBuilderthat starts with the specifiedWhereclause -
Creates a
QueryChainBuilderthat starts with aSelectclause created from the specified key pathDeclaration
Swift
public func select<R>(_ keyPath: KeyPath<O, ValueContainer<O>.Required<R>>) -> QueryChainBuilder<O, R> where R : ImportableAttributeTypeParameters
keyPaththe keyPath to query the value for
Return Value
a
QueryChainBuilderthat starts with aSelectclause created from the specified key path -
Creates a
QueryChainBuilderthat starts with aSelectclause created from the specified key pathDeclaration
Swift
public func select<R>(_ keyPath: KeyPath<O, ValueContainer<O>.Optional<R>>) -> QueryChainBuilder<O, R> where R : ImportableAttributeTypeParameters
keyPaththe keyPath to query the value for
Return Value
a
QueryChainBuilderthat starts with aSelectclause created from the specified key path -
Creates a
QueryChainBuilderthat starts with aSelectclause created from the specified key pathDeclaration
Swift
public func select<R>(_ keyPath: KeyPath<O, TransformableContainer<O>.Required<R>>) -> QueryChainBuilder<O, R> where R : SelectResultType, R : NSCoding, R : NSCopyingParameters
keyPaththe keyPath to query the value for
Return Value
a
QueryChainBuilderthat starts with aSelectclause created from the specified key path -
Creates a
QueryChainBuilderthat starts with aSelectclause created from the specified key pathDeclaration
Swift
public func select<R>(_ keyPath: KeyPath<O, TransformableContainer<O>.Optional<R>>) -> QueryChainBuilder<O, R> where R : SelectResultType, R : NSCoding, R : NSCopyingParameters
keyPaththe keyPath to query the value for
Return Value
a
QueryChainBuilderthat starts with aSelectclause created from the specified key path -
Creates a
SectionMonitorChainBuilderwith the key path to use to groupListMonitorobjects into sectionsDeclaration
Swift
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, FieldContainer<O>.Stored<T>>) -> SectionMonitorChainBuilder<O> where T : FieldStorableTypeParameters
sectionKeyPaththe
KeyPathto use to group the objects into sectionsReturn Value
a
SectionMonitorChainBuilderthat is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilderwith the key path to use to groupListMonitorobjects into sectionsDeclaration
Swift
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, FieldContainer<O>.Virtual<T>>) -> SectionMonitorChainBuilder<O>Parameters
sectionKeyPaththe
KeyPathto use to group the objects into sectionsReturn Value
a
SectionMonitorChainBuilderthat is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilderwith the key path to use to groupListMonitorobjects into sectionsDeclaration
Swift
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, FieldContainer<O>.Coded<T>>) -> SectionMonitorChainBuilder<O>Parameters
sectionKeyPaththe
KeyPathto use to group the objects into sectionsReturn Value
a
SectionMonitorChainBuilderthat is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilderwith the key path to use to groupListMonitorobjects into sectionsDeclaration
Swift
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, ValueContainer<O>.Required<T>>) -> SectionMonitorChainBuilder<O> where T : ImportableAttributeTypeParameters
sectionKeyPaththe
KeyPathto use to group the objects into sectionsReturn Value
a
SectionMonitorChainBuilderthat is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilderwith the key path to use to groupListMonitorobjects into sectionsDeclaration
Swift
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, ValueContainer<O>.Optional<T>>) -> SectionMonitorChainBuilder<O> where T : ImportableAttributeTypeParameters
sectionKeyPaththe
KeyPathto use to group the objects into sectionsReturn Value
a
SectionMonitorChainBuilderthat is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilderwith the key path to use to groupListMonitorobjects into sectionsDeclaration
Swift
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, TransformableContainer<O>.Required<T>>) -> SectionMonitorChainBuilder<O> where T : NSCoding, T : NSCopyingParameters
sectionKeyPaththe
KeyPathto use to group the objects into sectionsReturn Value
a
SectionMonitorChainBuilderthat is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilderwith the key path to use to groupListMonitorobjects into sectionsDeclaration
Swift
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, TransformableContainer<O>.Optional<T>>) -> SectionMonitorChainBuilder<O> where T : NSCoding, T : NSCopyingParameters
sectionKeyPaththe
KeyPathto use to group the objects into sectionsReturn Value
a
SectionMonitorChainBuilderthat is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilderwith the key path to use to groupListMonitorobjects into sections, and a closure to transform the value for the key path to an appropriate section index titleImportant
Some utilities (such asListMonitors) may keepSectionBys in memory and may thus introduce retain cycles if reference captures are not handled properly.Declaration
Swift
public func sectionBy<T>( _ sectionKeyPath: KeyPath<O, FieldContainer<O>.Stored<T>>, sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? ) -> SectionMonitorChainBuilder<O>Parameters
sectionKeyPaththe
KeyPathto use to group the objects into sectionssectionIndexTransformera closure to transform the value for the key path to an appropriate section index title
Return Value
a
SectionMonitorChainBuilderthat is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilderwith the key path to use to groupListMonitorobjects into sections, and a closure to transform the value for the key path to an appropriate section index titleImportant
Some utilities (such asListMonitors) may keepSectionBys in memory and may thus introduce retain cycles if reference captures are not handled properly.Declaration
Swift
public func sectionBy<T>( _ sectionKeyPath: KeyPath<O, FieldContainer<O>.Virtual<T>>, sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? ) -> SectionMonitorChainBuilder<O>Parameters
sectionKeyPaththe
KeyPathto use to group the objects into sectionssectionIndexTransformera closure to transform the value for the key path to an appropriate section index title
Return Value
a
SectionMonitorChainBuilderthat is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilderwith the key path to use to groupListMonitorobjects into sections, and a closure to transform the value for the key path to an appropriate section index titleImportant
Some utilities (such asListMonitors) may keepSectionBys in memory and may thus introduce retain cycles if reference captures are not handled properly.Declaration
Swift
public func sectionBy<T>( _ sectionKeyPath: KeyPath<O, FieldContainer<O>.Coded<T>>, sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? ) -> SectionMonitorChainBuilder<O>Parameters
sectionKeyPaththe
KeyPathto use to group the objects into sectionssectionIndexTransformera closure to transform the value for the key path to an appropriate section index title
Return Value
a
SectionMonitorChainBuilderthat is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilderwith the key path to use to groupListMonitorobjects into sections, and a closure to transform the value for the key path to an appropriate section index titleImportant
Some utilities (such asListMonitors) may keepSectionBys in memory and may thus introduce retain cycles if reference captures are not handled properly.Declaration
Swift
public func sectionBy<T>( _ sectionKeyPath: KeyPath<O, ValueContainer<O>.Required<T>>, sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? ) -> SectionMonitorChainBuilder<O>Parameters
sectionKeyPaththe
KeyPathto use to group the objects into sectionssectionIndexTransformera closure to transform the value for the key path to an appropriate section index title
Return Value
a
SectionMonitorChainBuilderthat is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilderwith the key path to use to groupListMonitorobjects into sections, and a closure to transform the value for the key path to an appropriate section index titleImportant
Some utilities (such asListMonitors) may keepSectionBys in memory and may thus introduce retain cycles if reference captures are not handled properly.Declaration
Swift
public func sectionBy<T>( _ sectionKeyPath: KeyPath<O, ValueContainer<O>.Optional<T>>, sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? ) -> SectionMonitorChainBuilder<O>Parameters
sectionKeyPaththe
KeyPathto use to group the objects into sectionssectionIndexTransformera closure to transform the value for the key path to an appropriate section index title
Return Value
a
SectionMonitorChainBuilderthat is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilderwith the key path to use to groupListMonitorobjects into sections, and a closure to transform the value for the key path to an appropriate section index titleImportant
Some utilities (such asListMonitors) may keepSectionBys in memory and may thus introduce retain cycles if reference captures are not handled properly.Declaration
Swift
public func sectionBy<T>( _ sectionKeyPath: KeyPath<O, TransformableContainer<O>.Required<T>>, sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? ) -> SectionMonitorChainBuilder<O>Parameters
sectionKeyPaththe
KeyPathto use to group the objects into sectionssectionIndexTransformera closure to transform the value for the key path to an appropriate section index title
Return Value
a
SectionMonitorChainBuilderthat is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilderwith the key path to use to groupListMonitorobjects into sections, and a closure to transform the value for the key path to an appropriate section index titleImportant
Some utilities (such asListMonitors) may keepSectionBys in memory and may thus introduce retain cycles if reference captures are not handled properly.Declaration
Swift
public func sectionBy<T>( _ sectionKeyPath: KeyPath<O, TransformableContainer<O>.Optional<T>>, sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? ) -> SectionMonitorChainBuilder<O>Parameters
sectionKeyPaththe
KeyPathto use to group the objects into sectionssectionIndexTransformera closure to transform the value for the key path to an appropriate section index title
Return Value
a
SectionMonitorChainBuilderthat is sectioned by the specified key path
View on GitHub
From Structure Reference