---
title: "sourceInstances(forEntityMappingName:destinationInstances:)"
framework: coredata
role: symbol
role_heading: Instance Method
path: "coredata/nsmigrationmanager/sourceinstances(forentitymappingname:destinationinstances:)"
---

# sourceInstances(forEntityMappingName:destinationInstances:)

Returns the managed object instances in the source store used to create the given destination instances for the passed in property mapping.

## Declaration

```swift
func sourceInstances(forEntityMappingName mappingName: String, destinationInstances: [NSManagedObject]?) -> [NSManagedObject]
```

## Parameters

- `mappingName`: The name of an entity mapping in use.
- `destinationInstances`: A array of managed objects in the destination store.

## Return Value

Return Value An array containing the managed object instances in the source store used to create destinationInstances using the entity mapping named mappingName. If destinationInstances is nil, all of the source instances used to create the destination instance for this property mapping are returned.

## Discussion

Discussion This method throws an NSInvalidArgumentException exception if mappingName is not a valid mapping name.

## See Also

### Managing Sources and Destinations

- [associate(sourceInstance:withDestinationInstance:for:)](coredata/nsmigrationmanager/associate(sourceinstance:withdestinationinstance:for:).md)
- [destinationInstances(forEntityMappingName:sourceInstances:)](coredata/nsmigrationmanager/destinationinstances(forentitymappingname:sourceinstances:).md)
