<!--
{
  "availability" : [
    "iOS: 3.0.0 -",
    "iPadOS: 3.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.5.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreData",
  "identifier" : "/documentation/CoreData/NSMigrationManager/init(sourceModel:destinationModel:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core Data"
    ],
    "preciseIdentifier" : "c:objc(cs)NSMigrationManager(im)initWithSourceModel:destinationModel:"
  },
  "title" : "init(sourceModel:destinationModel:)"
}
-->

# init(sourceModel:destinationModel:)

Initializes a migration manager instance with given source and destination models.

```
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:)`](/documentation/CoreData/NSMigrationManager/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:)`](/documentation/CoreData/NSMigrationManager/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

[`destinationModel`](/documentation/CoreData/NSMigrationManager/destinationModel)

The destination model for the migration manager.

[`mappingModel`](/documentation/CoreData/NSMigrationManager/mappingModel)

The mapping model for the migration manager.

[`sourceModel`](/documentation/CoreData/NSMigrationManager/sourceModel)

The source model for the migration manager.

[`migrateStore(from:sourceType:options:with:toDestinationURL:destinationType:destinationOptions:)`](/documentation/CoreData/NSMigrationManager/migrateStore(from:sourceType:options:with:toDestinationURL:destinationType:destinationOptions:))

Migrates the store at a given source URL to the store at a given destination URL, performing all of the mappings specified in a given mapping model.

  [Core Data Model Versioning and Data Migration Programming Guide](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CoreDataVersioning/Articles/Introduction.html#//apple_ref/doc/uid/TP40004399)



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)