XcodeDataModelSchema

public final class XcodeDataModelSchema : DynamicSchema
extension XcodeDataModelSchema: CustomDebugStringConvertible, CoreStoreDebugStringConvertible

The XcodeDataModelSchema describes a model version declared in a single *.xcdatamodeld file.

CoreStoreDefaults.dataStack = DataStack(
    XcodeDataModelSchema(modelName: "MyAppV1", bundle: .main)
)
  • Creates a XcodeDataModelSchema for each of the models declared in the specified (.xcdatamodeld) model file.

    Declaration

    Swift

    public static func from(modelName: XcodeDataModelFileName, bundle: Bundle = Bundle.main, migrationChain: MigrationChain = nil) -> (allSchema: [XcodeDataModelSchema], currentModelVersion: ModelVersion)

    Parameters

    modelName

    the 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.

    bundle

    an optional bundle to load .xcdatamodeld models from. If not specified, the main bundle will be used.

    migrationChain

    the MigrationChain that 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.

    Return Value

    a tuple containing all XcodeDataModelSchema for the models declared in the specified .xcdatamodeld file, and the current model version string declared or inferred from the file.

  • Initializes an XcodeDataModelSchema from an *.xcdatamodeld version name and its containing Bundle.

    CoreStoreDefaults.dataStack = DataStack(
        XcodeDataModelSchema(modelName: "MyAppV1", bundle: .main)
    )
    

    Declaration

    Swift

    public convenience init(modelName: ModelVersion, bundle: Bundle = Bundle.main)

    Parameters

    modelName

    the model version, typically the file name of an *.xcdatamodeld file (without the file extension)

    bundle

    the Bundle that contains the .xcdatamodeld’s “momd” file. If not specified, the Bundle.main will be searched.

  • Initializes an XcodeDataModelSchema from an *.xcdatamodeld file URL.

    CoreStoreDefaults.dataStack = DataStack(
        XcodeDataModelSchema(modelName: "MyAppV1", modelVersionFileURL: fileURL)
    )
    

    Declaration

    Swift

    public required init(modelName: ModelVersion, modelVersionFileURL: URL)

    Parameters

    modelName

    the model version, typically the file name of an *.xcdatamodeld file (without the file extension)

    modelVersionFileURL

    the file URL that points to the .xcdatamodeld’s “momd” file.

DynamicSchema

CustomDebugStringConvertible

  • Declaration

    Swift

    public var debugDescription: String { get }