improved migrationchain validation

This commit is contained in:
John Rommel Estropia
2015-07-13 07:47:43 +09:00
parent a64bcc474e
commit f99349f99d
9 changed files with 89 additions and 41 deletions

View File

@@ -49,7 +49,7 @@ public final class DataStack {
- parameter modelName: the name of the (.xcdatamodeld) model file. If not specified, the application name will be used.
- parameter bundle: an optional bundle to load models from. If not specified, the main bundle will be used.
- parameter migrationChain: the `MigrationChain` that indicates the heirarchy of the model's version names. If not specified, will default to a non-migrating data stack.
- parameter migrationChain: the `MigrationChain` that indicates the sequence of model versions to be used as the order for incremental migration. If not specified, will default to a non-migrating data stack.
*/
public required init(modelName: String = applicationName, bundle: NSBundle = NSBundle.mainBundle(), migrationChain: MigrationChain = nil) {
@@ -61,7 +61,7 @@ public final class DataStack {
let model = NSManagedObjectModel.fromBundle(
bundle,
modelName: modelName,
modelVersion: migrationChain.leafVersions.first
modelVersionHints: migrationChain.leafVersions
)
self.coordinator = NSPersistentStoreCoordinator(managedObjectModel: model)