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
XcodeDataModelSchemafor 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
modelNamethe 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.
bundlean optional bundle to load .xcdatamodeld models from. If not specified, the main bundle will be used.
migrationChainthe
MigrationChainthat 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
XcodeDataModelSchemafor the models declared in the specified .xcdatamodeld file, and the current model version string declared or inferred from the file. -
Initializes an
XcodeDataModelSchemafrom an *.xcdatamodeld version name and its containingBundle.CoreStoreDefaults.dataStack = DataStack( XcodeDataModelSchema(modelName: "MyAppV1", bundle: .main) )Declaration
Swift
public convenience init(modelName: ModelVersion, bundle: Bundle = Bundle.main)Parameters
modelNamethe model version, typically the file name of an *.xcdatamodeld file (without the file extension)
bundlethe
Bundlethat contains the .xcdatamodeld’s “momd” file. If not specified, theBundle.mainwill be searched. -
Initializes an
XcodeDataModelSchemafrom an *.xcdatamodeld file URL.CoreStoreDefaults.dataStack = DataStack( XcodeDataModelSchema(modelName: "MyAppV1", modelVersionFileURL: fileURL) )Declaration
Swift
public required init(modelName: ModelVersion, modelVersionFileURL: URL)Parameters
modelNamethe model version, typically the file name of an *.xcdatamodeld file (without the file extension)
modelVersionFileURLthe file URL that points to the .xcdatamodeld’s “momd” file.
-
Declaration
Swift
public let modelVersion: ModelVersion -
Declaration
Swift
public func rawModel() -> NSManagedObjectModel
-
Declaration
Swift
public var debugDescription: String { get }
View on GitHub
XcodeDataModelSchema Class Reference