DynamicSchema
public protocol DynamicSchema
DynamicSchema are types that provide NSManagedObjectModel instances for a single model version. CoreStore currently supports the following concrete types:
XcodeDataModelSchema: describes models loaded from a .xcdatamodeld file.UnsafeDataModelSchema: describes models loaded directly from an existingNSManagedObjectModel. It is not advisable to continue using this model as its metadata are not available to CoreStore.CoreStoreSchema: describes models written forCoreStoreObjectSwift class declarations.
-
The version string for this model schema.
Declaration
Swift
var modelVersion: ModelVersion { get } -
Do not call this directly. The
NSManagedObjectModelfor this schema may be created lazily and using this method directly may affect the integrity of the model.Declaration
Swift
func rawModel() -> NSManagedObjectModel
-
printCoreStoreSchema()Extension methodPrints the
DynamicSchemaas their correspondingCoreStoreObjectSwift declarations. This is useful for converting currentXcodeDataModelSchema-based models into the newCoreStoreSchemaframework. Additional adjustments may need to be done to the generated source code; for example:Transformableconcrete types need to be provided, as well asdefaultvalues.Important
After transitioning to the newCoreStoreSchemaframework, it is recommended to add the new schema as a new version that the existing versions’XcodeDataModelSchemacan migrate to. It is discouraged to load existing SQLite files created withXcodeDataModelSchemadirectly into aCoreStoreSchema.Declaration
Swift
public func printCoreStoreSchema() -> StringReturn Value
a string that represents the source code for the
DynamicSchemaas their correspondingCoreStoreObjectSwift declarations.
View on GitHub
DynamicSchema Protocol Reference