<!--
{
  "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/NSEntityMapping",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Core Data"
    ],
    "preciseIdentifier" : "c:objc(cs)NSEntityMapping"
  },
  "title" : "NSEntityMapping"
}
-->

# NSEntityMapping

A mapping instance that specifies how to map an entity from a source to a destination managed object model.

```
class NSEntityMapping
```

## Topics

### Managing Source Information

[`sourceEntityName`](/documentation/CoreData/NSEntityMapping/sourceEntityName)

The source entity name for the entity mapping.

[`sourceEntityVersionHash`](/documentation/CoreData/NSEntityMapping/sourceEntityVersionHash)

The version hash of the source entity for the entity mapping.

[`sourceExpression`](/documentation/CoreData/NSEntityMapping/sourceExpression)

The source expression for the entity mapping.

### Managing Destination Information

[`destinationEntityName`](/documentation/CoreData/NSEntityMapping/destinationEntityName)

The destination entity name for the entity mapping.

[`destinationEntityVersionHash`](/documentation/CoreData/NSEntityMapping/destinationEntityVersionHash)

The version hash for the destination entity for the entity mapping.

### Managing Mapping Information

[`name`](/documentation/CoreData/NSEntityMapping/name)

The name of the entity mapping.

[`mappingType`](/documentation/CoreData/NSEntityMapping/mappingType)

The mapping type for the entity mapping.

[`entityMigrationPolicyClassName`](/documentation/CoreData/NSEntityMapping/entityMigrationPolicyClassName)

The class name of the migration policy for the entity mapping.

[`attributeMappings`](/documentation/CoreData/NSEntityMapping/attributeMappings)

The array of attribute mappings for the entity mapping.

[`relationshipMappings`](/documentation/CoreData/NSEntityMapping/relationshipMappings)

The array of relationship mappings for the entity mapping.

[`userInfo`](/documentation/CoreData/NSEntityMapping/userInfo)

The user info dictionary for the entity mapping.

### Constants

[`NSUndefinedEntityMappingType`](/documentation/CoreData/NSEntityMappingType/undefinedEntityMappingType)

Specifies that the developer handles destination instance creation.

[`NSCustomEntityMappingType`](/documentation/CoreData/NSEntityMappingType/customEntityMappingType)

Specifies a custom mapping.

[`NSAddEntityMappingType`](/documentation/CoreData/NSEntityMappingType/addEntityMappingType)

Specifies that this is a new entity in the destination model.

[`NSRemoveEntityMappingType`](/documentation/CoreData/NSEntityMappingType/removeEntityMappingType)

Specifies that this entity is not present in the destination model.

[`NSCopyEntityMappingType`](/documentation/CoreData/NSEntityMappingType/copyEntityMappingType)

Specifies that source instances are migrated as-is.

[`NSTransformEntityMappingType`](/documentation/CoreData/NSEntityMappingType/transformEntityMappingType)

Specifies that entity exists in source and destination and is mapped.

## Relationships

### Conforms To

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)