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

# NSAttributeDescription

A description of a single attribute belonging to an entity.

```
class NSAttributeDescription
```

## Overview

`NSAttributeDescription` inherits from [`NSPropertyDescription`](/documentation/CoreData/NSPropertyDescription), which provides most of the basic behavior. Instances of `NSAttributeDescription` are used to describe attributes, as distinct from relationships. The class adds the ability to specify the attribute type, and to specify a default value. In a managed object model, you must specify the type of all attributes—you can only use the undefined attribute type (`NSUndefinedAttributeType`) for transient attributes.

### Editing Attribute Descriptions

Attribute descriptions are editable until they are used by an object graph manager. This allows you to create or modify them dynamically. However, once a description is used (when the managed object model to which it belongs is associated with a persistent store coordinator), it *must not* (indeed cannot) be changed. This is enforced at runtime: any attempt to mutate a model or any of its sub-objects after the model is associated with a persistent store coordinator causes an exception to be thrown. If you need to modify a model that is in use, create a copy, modify the copy, and then discard the objects with the old model.

> Note:
> Default values set for attributes are retained by a managed object model, not copied. This means that attribute values do not have to implement the `NSCopying` protocol, however it also means that you should not modify any objects after they have been set as default values.

## Topics

### Managing the type

[`attributeValueClassName`](/documentation/CoreData/NSAttributeDescription/attributeValueClassName)

The class name that represents the attribute’s value.

[`type`](/documentation/CoreData/NSAttributeDescription/type)

The attribute’s type.

[`AttributeType`](/documentation/CoreData/NSAttributeDescription/AttributeType-swift.struct)

The types of attributes that Core Data supports.

[`attributeType`](/documentation/CoreData/NSAttributeDescription/attributeType-swift.property)

The attribute’s type.

[`NSAttributeType`](/documentation/CoreData/NSAttributeType)

The types of attribute that Core Data supports.

### Configuring the behavior

[`allowsCloudEncryption`](/documentation/CoreData/NSAttributeDescription/allowsCloudEncryption)

A Boolean value that determines whether to encrypt the attribute’s value.

[`allowsExternalBinaryDataStorage`](/documentation/CoreData/NSAttributeDescription/allowsExternalBinaryDataStorage)

A Boolean value that indicates whether the attribute allows external binary storage.

[`defaultValue`](/documentation/CoreData/NSAttributeDescription/defaultValue)

The default value of the attribute.

[`preservesValueInHistoryOnDeletion`](/documentation/CoreData/NSAttributeDescription/preservesValueInHistoryOnDeletion)

A Boolean value that indicates whether the attribute records its value in the persistent history transaction for a managed object’s deletion.

[`valueTransformerName`](/documentation/CoreData/NSAttributeDescription/valueTransformerName)

The name of the transformer to use for the attribute value.

### Getting version information

[`versionHash`](/documentation/CoreData/NSAttributeDescription/versionHash)

The version hash for the attribute.

### Deprecated

[Deprecated symbols](/documentation/CoreData/nsattributedescription-deprecated-symbols)

Review unsupported symbols and their replacements.

## Relationships

### Inherits From

[`NSPropertyDescription`](/documentation/CoreData/NSPropertyDescription)

### Inherited By

[`NSDerivedAttributeDescription`](/documentation/CoreData/NSDerivedAttributeDescription)

[`NSCompositeAttributeDescription`](/documentation/CoreData/NSCompositeAttributeDescription)

### Conforms To

[`NSCopying`](/documentation/Foundation/NSCopying)

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

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

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

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

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

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

[`NSCoding`](/documentation/Foundation/NSCoding)

---

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)