init(sourceModel:destinationModel:)
Initializes a migration manager instance with given source and destination models.
Declaration
init(sourceModel: NSManagedObjectModel, destinationModel: NSManagedObjectModel)Parameters
- sourceModel:
The source managed object model for the migration manager.
- destinationModel:
The destination managed object model for the migration manager.
Return Value
A migration manager instance initialized to migrate data in a store that uses sourceModel to a store that uses destinationModel.
Discussion
You specify the mapping model in the migration method, migrateStore(from:sourceType:options:with:toDestinationURL:destinationType:destinationOptions:).
Special Considerations
This is the designated initializer for NSMigrationManager.
Although validation of the models is performed during migrateStore(from:sourceType:options:with:toDestinationURL:destinationType:destinationOptions:), as with NSPersistentStoreCoordinator once models are added to the migration manager they are immutable and cannot be altered.
See Also
Related Documentation
destinationModelmappingModelsourceModelmigrateStore(from:sourceType:options:with:toDestinationURL:destinationType:destinationOptions:)- Core Data Model Versioning and Data Migration Programming Guide