Class

NSAttributeDescription

A description of an attribute of a Core Data entity.

Declaration

@interface NSAttributeDescription : NSPropertyDescription

Overview

NSAttributeDescription inherits from 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.

Topics

Getting and Setting Type Information

attributeType

The type of the attribute.

attributeValueClassName

The name of the class used to represent the attribute.

Getting and Setting the Default Value

defaultValue

The default value of the attribute.

Supporting Versioning

versionHash

The version hash for the attribute.

Transforming the Attribute Value

valueTransformerName

The name of the transformer used to transform the attribute value.

Specifying External Binary Storage

allowsExternalBinaryDataStorage

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

Tracking Persistent History

preservesValueInHistoryOnDeletion

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

Defining Attribute Types

NSAttributeType

The possible types of Core Data attributes.

Relationships

See Also

Attributes and Relationships

NSPropertyDescription

A description of a property of a Core Data entity.

NSAttributeType

The possible types of Core Data attributes.

NSDerivedAttributeDescription

A description of an attribute of a Core Data entity that derives its value from one or more other properties.

NSRelationshipDescription

A description of a relationship of a Core Data entity.