From

public struct From<D> where D : DynamicObject

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 NSManagedObject or CoreStoreObject entity class

    Declaration

    Swift

    public let entityClass: D.Type
  • The NSPersistentStore configuration names to associate objects from. May contain Strings to pertain to named configurations, or nil to pertain to the default configuration

    Declaration

    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: D.Type)

    Parameters

    entity

    the associated NSManagedObject or CoreStoreObject 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 created NSManagedObject or CoreStoreObject‘s entity type. Set to nil 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 created NSManagedObject or CoreStoreObject‘s entity type. Set to nil 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: D.Type, _ configuration: ModelConfiguration, _ otherConfigurations: ModelConfiguration...)

    Parameters

    entity

    the associated NSManagedObject or CoreStoreObject type

    configuration

    the NSPersistentStore configuration name to associate objects from. This parameter is required if multiple configurations contain the created NSManagedObject or CoreStoreObject‘s entity type. Set to nil 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: D.Type, _ configurations: [ModelConfiguration])

    Parameters

    entity

    the associated NSManagedObject or CoreStoreObject type

    configurations

    a list of NSPersistentStore configuration names to associate objects from. This parameter is required if multiple configurations contain the created NSManagedObject or CoreStoreObject‘s entity type. Set to nil to use the default configuration.

  • Declaration

    Swift

    public var debugDescription: String { get }
  • Creates a QueryChainBuilder that starts with a Select clause created from the specified key path

    Declaration

    Swift

    public func select<R>(_ keyPath: KeyPath<D, R>) -> QueryChainBuilder<D, R> where R : SelectResultType

    Parameters

    keyPath

    the keyPath to query the value for

    Return Value

    a QueryChainBuilder that starts with a Select clause created from the specified key path

  • Creates a SectionMonitorChainBuilder with the key path to use to group ListMonitor objects into sections

    Declaration

    Swift

    @available(OSX 10.12, *)
    public func sectionBy<T>(_ sectionKeyPath: KeyPath<D, T>) -> SectionMonitorChainBuilder<D>

    Parameters

    sectionKeyPath

    the KeyPath 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 group ListMonitor objects into sections, and a closure to transform the value for the key path to an appropriate section name

    Important

    Some utilities (such as ListMonitors) may keep SectionBys in memory and may thus introduce retain cycles if reference captures are not handled properly.

    Declaration

    Swift

    @available(OSX 10.12, *)
    public func sectionBy<T>(_ sectionKeyPath: KeyPath<D, T>, _ sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?) -> SectionMonitorChainBuilder<D>

    Parameters

    sectionKeyPath

    the KeyPath to use to group the objects into sections

    sectionIndexTransformer

    a closure to transform the value for the key path to an appropriate section name

    Return Value

    a SectionMonitorChainBuilder that is sectioned by the specified key path