# 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 existing `NSManagedObjectModel`. It is not advisable to continue using this model as its metadata are not available to CoreStore.
- `CoreStoreSchema`: describes models written for `CoreStoreObject` Swift class declarations.

- `modelVersion`

  The version string for this model schema.

  #### Declaration

  Swift

      var modelVersion: ModelVersion { get }

- `rawModel()`

  Do not call this directly. The `NSManagedObjectModel` for this schema may be created lazily and using this method directly may affect the integrity of the model.

  #### Declaration

  Swift

      func rawModel() -> NSManagedObjectModel

### DynamicSchema

- `printCoreStoreSchema()` Extension method

  Prints the `DynamicSchema` as their corresponding `CoreStoreObject` Swift declarations. This is useful for converting current `XcodeDataModelSchema`-based models into the new `CoreStoreSchema` framework. Additional adjustments may need to be done to the generated source code; for example: `Transformable` concrete types need to be provided, as well as `default` values.

  Important

  After transitioning to the new `CoreStoreSchema` framework, it is recommended to add the new schema as a new version that the existing versions’ `XcodeDataModelSchema` can migrate to. It is discouraged to load existing SQLite files created with `XcodeDataModelSchema` directly into a `CoreStoreSchema`.

  #### Declaration

  Swift

      public func printCoreStoreSchema() -> String

  #### Return Value

  a string that represents the source code for the `DynamicSchema` as their corresponding `CoreStoreObject` Swift declarations.