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 NSPersistentStore
s contain the same entity, the source configuration’s name needs to be specified as well:
let person = transaction.fetchOne(From<Person>("Configuration1"))
-
The associated
NSManagedObject
orCoreStoreObject
entity classDeclaration
Swift
public let entityClass: O.Type
-
The
NSPersistentStore
configuration names to associate objects from. May containString
s to pertain to named configurations, ornil
to pertain to the default configurationDeclaration
Swift
public let configurations: [ModelConfiguration]?
-
Initializes a
From
clause.let people = transaction.fetchAll(From<MyPersonEntity>())
Declaration
Swift
public init()
-
Initializes a
From
clause with the specified entity type.let people = transaction.fetchAll(From<MyPersonEntity>())
Declaration
Swift
public init(_ entity: O.Type)
Parameters
entity
the associated
NSManagedObject
orCoreStoreObject
type -
Initializes a
From
clause with the specified configurations.let people = transaction.fetchAll(From<MyPersonEntity>(nil, "Configuration1"))
Declaration
Swift
public init(_ configuration: ModelConfiguration, _ otherConfigurations: ModelConfiguration...)
Parameters
configuration
the
NSPersistentStore
configuration name to associate objects from. This parameter is required if multiple configurations contain the createdNSManagedObject
orCoreStoreObject
‘s entity type. Set tonil
to use the default configuration.otherConfigurations
an optional list of other configuration names to associate objects from (see
configuration
parameter) -
Initializes a
From
clause with the specified configurations.let people = transaction.fetchAll(From<MyPersonEntity>(["Configuration1", "Configuration2"]))
Declaration
Swift
public init(_ configurations: [ModelConfiguration])
Parameters
configurations
a list of
NSPersistentStore
configuration names to associate objects from. This parameter is required if multiple configurations contain the createdNSManagedObject
orCoreStoreObject
‘s entity type. Set tonil
to use the default configuration. -
Initializes a
From
clause 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
entity
the associated
NSManagedObject
orCoreStoreObject
typeconfiguration
the
NSPersistentStore
configuration name to associate objects from. This parameter is required if multiple configurations contain the createdNSManagedObject
orCoreStoreObject
‘s entity type. Set tonil
to use the default configuration.otherConfigurations
an optional list of other configuration names to associate objects from (see
configuration
parameter) -
Initializes a
From
clause with the specified configurations.let people = transaction.fetchAll(From(MyPersonEntity.self, ["Configuration1", "Configuration1"]))
Declaration
Swift
public init(_ entity: O.Type, _ configurations: [ModelConfiguration])
Parameters
entity
the associated
NSManagedObject
orCoreStoreObject
typeconfigurations
a list of
NSPersistentStore
configuration names to associate objects from. This parameter is required if multiple configurations contain the createdNSManagedObject
orCoreStoreObject
‘s entity type. Set tonil
to use the default configuration.
-
Declaration
Swift
public var debugDescription: String { get }
-
Creates a
FetchChainBuilder
that starts with the specifiedWhere
clauseDeclaration
Swift
public func `where`(_ clause: Where<O>) -> FetchChainBuilder<O>
Parameters
clause
the
Where
clause to create aFetchChainBuilder
withReturn Value
a
FetchChainBuilder
that starts with the specifiedWhere
clause -
Creates a
FetchChainBuilder
thatAND
s the specifiedWhere
clauses. 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
clauses
the
Where
clauses to create aFetchChainBuilder
withReturn Value
a
FetchChainBuilder
thatAND
s the specifiedWhere
clauses -
Creates a
FetchChainBuilder
thatOR
s the specifiedWhere
clauses. 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
clauses
the
Where
clauses to create aFetchChainBuilder
withReturn Value
a
FetchChainBuilder
thatOR
s the specifiedWhere
clauses -
Creates a
FetchChainBuilder
with a predicate using the specified string format and argumentsDeclaration
Swift
public func `where`( format: String, _ args: Any... ) -> FetchChainBuilder<O>
Parameters
format
the format string for the predicate
args
the arguments for
format
Return Value
a
FetchChainBuilder
with a predicate using the specified string format and arguments -
Creates a
FetchChainBuilder
with a predicate using the specified string format and argumentsDeclaration
Swift
public func `where`( format: String, argumentArray: [Any]? ) -> FetchChainBuilder<O>
Parameters
format
the format string for the predicate
argumentArray
the arguments for
format
Return Value
a
FetchChainBuilder
with a predicate using the specified string format and arguments -
Creates a
FetchChainBuilder
that starts with the specifiedOrderBy
clause.Declaration
Swift
public func orderBy(_ clause: OrderBy<O>) -> FetchChainBuilder<O>
Parameters
clause
the
OrderBy
clause to create aFetchChainBuilder
withReturn Value
a
FetchChainBuilder
that starts with the specifiedOrderBy
clause -
Creates a
FetchChainBuilder
with a series ofSortKey
sDeclaration
Swift
public func orderBy( _ sortKey: OrderBy<O>.SortKey, _ sortKeys: OrderBy<O>.SortKey... ) -> FetchChainBuilder<O>
Parameters
sortKey
a single
SortKey
sortKeys
a series of other
SortKey
sReturn Value
a
FetchChainBuilder
with a series ofSortKey
s -
Creates a
FetchChainBuilder
with a series ofSortKey
sDeclaration
Swift
public func orderBy(_ sortKeys: [OrderBy<O>.SortKey]) -> FetchChainBuilder<O>
Parameters
sortKeys
a series of
SortKey
sReturn Value
a
FetchChainBuilder
with a series ofSortKey
s -
Creates a
FetchChainBuilder
with a closure where theNSFetchRequest
may be configuredDeclaration
Swift
public func tweak(_ fetchRequest: @escaping (NSFetchRequest<NSFetchRequestResult>) -> Void) -> FetchChainBuilder<O>
Parameters
fetchRequest
the block to customize the
NSFetchRequest
Return Value
a
FetchChainBuilder
with closure where theNSFetchRequest
may be configured -
Creates a
FetchChainBuilder
and immediately appending aFetchClause
Declaration
Swift
public func appending(_ clause: FetchClause) -> FetchChainBuilder<O>
Parameters
clause
the
FetchClause
to add to theFetchChainBuilder
Return Value
a
FetchChainBuilder
containing the specifiedFetchClause
-
Creates a
FetchChainBuilder
and immediately appending a series ofFetchClause
sDeclaration
Swift
public func appending<S>(contentsOf clauses: S) -> FetchChainBuilder<O> where S : Sequence, S.Element == FetchClause
Parameters
clauses
the
FetchClause
s to add to theFetchChainBuilder
Return Value
a
FetchChainBuilder
containing the specifiedFetchClause
s -
Creates a
QueryChainBuilder
that starts with the specifiedSelect
clauseDeclaration
Swift
public func select<R>(_ clause: Select<O, R>) -> QueryChainBuilder<O, R> where R : SelectResultType
Parameters
clause
the
Select
clause to create aQueryChainBuilder
withReturn Value
a
QueryChainBuilder
that starts with the specifiedSelect
clause -
Creates a
QueryChainBuilder
that starts with aSelect
clause created from the specifiedSelectTerm
sDeclaration
Swift
public func select<R>( _ resultType: R.Type, _ selectTerm: SelectTerm<O>, _ selectTerms: SelectTerm<O>... ) -> QueryChainBuilder<O, R>
Parameters
resultType
the generic
SelectResultType
for theSelect
clauseselectTerm
selectTerms
a series of
SelectTerm
sReturn Value
a
QueryChainBuilder
that starts with aSelect
clause created from the specifiedSelectTerm
s -
Creates a
QueryChainBuilder
that starts with aSelect
clause created from the specifiedSelectTerm
sDeclaration
Swift
public func select<R>( _ resultType: R.Type, _ selectTerms: [SelectTerm<O>] ) -> QueryChainBuilder<O, R>
Parameters
resultType
the generic
SelectResultType
for theSelect
clauseselectTerms
a series of
SelectTerm
sReturn Value
a
QueryChainBuilder
that starts with aSelect
clause created from the specifiedSelectTerm
s -
Creates a
SectionMonitorChainBuilder
that starts with theSectionBy
to use to groupListMonitor
objects into sectionsDeclaration
Swift
public func sectionBy(_ clause: SectionBy<O>) -> SectionMonitorChainBuilder<O>
Parameters
clause
the
SectionBy
to be used by theListMonitor
Return Value
a
SectionMonitorChainBuilder
that is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilder
with the key path to use to groupListMonitor
objects into sectionsDeclaration
Swift
public func sectionBy(_ sectionKeyPath: KeyPathString) -> SectionMonitorChainBuilder<O>
Parameters
sectionKeyPath
the key path to use to group the objects into sections
Return Value
a
SectionMonitorChainBuilder
that is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilder
with the key path to use to groupListMonitor
objects into sections, and a closure to transform the value for the key path to an appropriate section index titleImportant
Some utilities (such asListMonitor
s) may keepSectionBy
s 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
sectionKeyPath
the key path to use to group the objects into sections
sectionIndexTransformer
a closure to transform the value for the key path to an appropriate section index title
Return Value
a
SectionMonitorChainBuilder
that is sectioned by the specified key path
-
Creates a
QueryChainBuilder
that starts with aSelect
clause created from the specified key pathDeclaration
Swift
public func select<R>(_ keyPath: KeyPath<O, R>) -> QueryChainBuilder<O, R> where R : SelectResultType
Parameters
keyPath
the keyPath to query the value for
Return Value
a
QueryChainBuilder
that starts with aSelect
clause created from the specified key path -
Creates a
SectionMonitorChainBuilder
with the key path to use to groupListMonitor
objects into sectionsDeclaration
Swift
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, T>) -> SectionMonitorChainBuilder<O>
Parameters
sectionKeyPath
the
KeyPath
to use to group the objects into sectionsReturn Value
a
SectionMonitorChainBuilder
that is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilder
with the key path to use to groupListMonitor
objects into sections, and a closure to transform the value for the key path to an appropriate section index titleImportant
Some utilities (such asListMonitor
s) may keepSectionBy
s 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
sectionKeyPath
the
KeyPath
to use to group the objects into sectionssectionIndexTransformer
a closure to transform the value for the key path to an appropriate section index title
Return Value
a
SectionMonitorChainBuilder
that is sectioned by the specified key path
-
Creates a
FetchChainBuilder
that starts with the specifiedWhere
clauseDeclaration
Swift
public func `where`<T>(_ clause: (O) -> T) -> FetchChainBuilder<O> where T : AnyWhereClause
Parameters
clause
a closure that returns a
Where
clauseReturn Value
a
FetchChainBuilder
that starts with the specifiedWhere
clause -
Creates a
QueryChainBuilder
that starts with aSelect
clause created from the specified key pathDeclaration
Swift
public func select<R>(_ keyPath: KeyPath<O, ValueContainer<O>.Required<R>>) -> QueryChainBuilder<O, R> where R : ImportableAttributeType
Parameters
keyPath
the keyPath to query the value for
Return Value
a
QueryChainBuilder
that starts with aSelect
clause created from the specified key path -
Creates a
QueryChainBuilder
that starts with aSelect
clause created from the specified key pathDeclaration
Swift
public func select<R>(_ keyPath: KeyPath<O, ValueContainer<O>.Optional<R>>) -> QueryChainBuilder<O, R> where R : ImportableAttributeType
Parameters
keyPath
the keyPath to query the value for
Return Value
a
QueryChainBuilder
that starts with aSelect
clause created from the specified key path -
Creates a
QueryChainBuilder
that starts with aSelect
clause 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 : NSCopying
Parameters
keyPath
the keyPath to query the value for
Return Value
a
QueryChainBuilder
that starts with aSelect
clause created from the specified key path -
Creates a
QueryChainBuilder
that starts with aSelect
clause 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 : NSCopying
Parameters
keyPath
the keyPath to query the value for
Return Value
a
QueryChainBuilder
that starts with aSelect
clause created from the specified key path -
Creates a
SectionMonitorChainBuilder
with the key path to use to groupListMonitor
objects into sectionsDeclaration
Swift
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, FieldContainer<O>.Stored<T>>) -> SectionMonitorChainBuilder<O> where T : FieldStorableType
Parameters
sectionKeyPath
the
KeyPath
to use to group the objects into sectionsReturn Value
a
SectionMonitorChainBuilder
that is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilder
with the key path to use to groupListMonitor
objects into sectionsDeclaration
Swift
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, FieldContainer<O>.Virtual<T>>) -> SectionMonitorChainBuilder<O>
Parameters
sectionKeyPath
the
KeyPath
to use to group the objects into sectionsReturn Value
a
SectionMonitorChainBuilder
that is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilder
with the key path to use to groupListMonitor
objects into sectionsDeclaration
Swift
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, FieldContainer<O>.Coded<T>>) -> SectionMonitorChainBuilder<O>
Parameters
sectionKeyPath
the
KeyPath
to use to group the objects into sectionsReturn Value
a
SectionMonitorChainBuilder
that is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilder
with the key path to use to groupListMonitor
objects into sectionsDeclaration
Swift
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, ValueContainer<O>.Required<T>>) -> SectionMonitorChainBuilder<O> where T : ImportableAttributeType
Parameters
sectionKeyPath
the
KeyPath
to use to group the objects into sectionsReturn Value
a
SectionMonitorChainBuilder
that is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilder
with the key path to use to groupListMonitor
objects into sectionsDeclaration
Swift
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, ValueContainer<O>.Optional<T>>) -> SectionMonitorChainBuilder<O> where T : ImportableAttributeType
Parameters
sectionKeyPath
the
KeyPath
to use to group the objects into sectionsReturn Value
a
SectionMonitorChainBuilder
that is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilder
with the key path to use to groupListMonitor
objects into sectionsDeclaration
Swift
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, TransformableContainer<O>.Required<T>>) -> SectionMonitorChainBuilder<O> where T : NSCoding, T : NSCopying
Parameters
sectionKeyPath
the
KeyPath
to use to group the objects into sectionsReturn Value
a
SectionMonitorChainBuilder
that is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilder
with the key path to use to groupListMonitor
objects into sectionsDeclaration
Swift
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, TransformableContainer<O>.Optional<T>>) -> SectionMonitorChainBuilder<O> where T : NSCoding, T : NSCopying
Parameters
sectionKeyPath
the
KeyPath
to use to group the objects into sectionsReturn Value
a
SectionMonitorChainBuilder
that is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilder
with the key path to use to groupListMonitor
objects into sections, and a closure to transform the value for the key path to an appropriate section index titleImportant
Some utilities (such asListMonitor
s) may keepSectionBy
s 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
sectionKeyPath
the
KeyPath
to use to group the objects into sectionssectionIndexTransformer
a closure to transform the value for the key path to an appropriate section index title
Return Value
a
SectionMonitorChainBuilder
that is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilder
with the key path to use to groupListMonitor
objects into sections, and a closure to transform the value for the key path to an appropriate section index titleImportant
Some utilities (such asListMonitor
s) may keepSectionBy
s 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
sectionKeyPath
the
KeyPath
to use to group the objects into sectionssectionIndexTransformer
a closure to transform the value for the key path to an appropriate section index title
Return Value
a
SectionMonitorChainBuilder
that is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilder
with the key path to use to groupListMonitor
objects into sections, and a closure to transform the value for the key path to an appropriate section index titleImportant
Some utilities (such asListMonitor
s) may keepSectionBy
s 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
sectionKeyPath
the
KeyPath
to use to group the objects into sectionssectionIndexTransformer
a closure to transform the value for the key path to an appropriate section index title
Return Value
a
SectionMonitorChainBuilder
that is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilder
with the key path to use to groupListMonitor
objects into sections, and a closure to transform the value for the key path to an appropriate section index titleImportant
Some utilities (such asListMonitor
s) may keepSectionBy
s 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
sectionKeyPath
the
KeyPath
to use to group the objects into sectionssectionIndexTransformer
a closure to transform the value for the key path to an appropriate section index title
Return Value
a
SectionMonitorChainBuilder
that is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilder
with the key path to use to groupListMonitor
objects into sections, and a closure to transform the value for the key path to an appropriate section index titleImportant
Some utilities (such asListMonitor
s) may keepSectionBy
s 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
sectionKeyPath
the
KeyPath
to use to group the objects into sectionssectionIndexTransformer
a closure to transform the value for the key path to an appropriate section index title
Return Value
a
SectionMonitorChainBuilder
that is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilder
with the key path to use to groupListMonitor
objects into sections, and a closure to transform the value for the key path to an appropriate section index titleImportant
Some utilities (such asListMonitor
s) may keepSectionBy
s 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
sectionKeyPath
the
KeyPath
to use to group the objects into sectionssectionIndexTransformer
a closure to transform the value for the key path to an appropriate section index title
Return Value
a
SectionMonitorChainBuilder
that is sectioned by the specified key path -
Creates a
SectionMonitorChainBuilder
with the key path to use to groupListMonitor
objects into sections, and a closure to transform the value for the key path to an appropriate section index titleImportant
Some utilities (such asListMonitor
s) may keepSectionBy
s 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
sectionKeyPath
the
KeyPath
to use to group the objects into sectionssectionIndexTransformer
a closure to transform the value for the key path to an appropriate section index title
Return Value
a
SectionMonitorChainBuilder
that is sectioned by the specified key path