---
title: "createDestinationInstances(forSource:in:manager:)"
framework: coredata
role: symbol
role_heading: Instance Method
path: "coredata/nsentitymigrationpolicy/createdestinationinstances(forsource:in:manager:)"
---

# createDestinationInstances(forSource:in:manager:)

Creates the destination instance(s) for a given source instance.

## Declaration

```swift
func createDestinationInstances(forSource sInstance: NSManagedObject, in mapping: NSEntityMapping, manager: NSMigrationManager) throws
```

## Parameters

- `sInstance`: The source instance for which to create destination instances.
- `mapping`: The mapping object in use.
- `manager`: The migration manager performing the migration.

## Discussion

Discussion This method is invoked by the migration manager on each source instance (as specified by the sourceExpression in the mapping) to create the corresponding destination instance(s). It also associates the source and destination instances by calling NSMigrationManager’s associate(sourceInstance:withDestinationInstance:for:) method. Special Considerations If you override this method and do not invoke super, you must invoke NSMigrationManager’s associate(sourceInstance:withDestinationInstance:for:) to associate the source and destination instances as required. .

## See Also

### Customizing Stages of the Mapping Life Cycle

- [begin(_:with:)](coredata/nsentitymigrationpolicy/begin(_:with:).md)
- [endInstanceCreation(forMapping:manager:)](coredata/nsentitymigrationpolicy/endinstancecreation(formapping:manager:).md)
- [createRelationships(forDestination:in:manager:)](coredata/nsentitymigrationpolicy/createrelationships(fordestination:in:manager:).md)
- [endRelationshipCreation(forMapping:manager:)](coredata/nsentitymigrationpolicy/endrelationshipcreation(formapping:manager:).md)
- [performCustomValidation(forMapping:manager:)](coredata/nsentitymigrationpolicy/performcustomvalidation(formapping:manager:).md)
- [end(_:manager:)](coredata/nsentitymigrationpolicy/end(_:manager:).md)
