Note that a property name cannot be the same as any no-parameter method name of NSObject or NSManagedObject. For example, you cannot give a property the name "description". There are hundreds of methods on NSObject which may conflict with property names—and this list can grow without warning from frameworks or other libraries. You should avoid very general words (like "font”, and “color”) and words or phrases which overlap with Cocoa paradigms (such as “isEditing” and “objectSpecifier”).

Properties—relationships as well as attributes—may be transient. A managed object context knows about transient properties and tracks changes made to them. Transient properties are ignored by the persistent store, and not just during saves: you cannot fetch using a predicate based on transients (although you can use transient properties to filter in memory yourself).

Editing Property Descriptions

Property descriptions are editable until they are used by an object graph manager (such as a persistent store coordinator). 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.

Import Statement

Availability

Declaration

Swift

var transient: Bool

Objective-C

@property(getter=isTransient)BOOLtransient

Discussion

YEStrue if the receiver is transient, otherwise NOfalse. The transient flag specifies whether or not a property’s value is ignored when an object is saved to a persistent store. Transient properties are not saved to the persistent store, but are still managed for undo, redo, validation, and so on.

Special Considerations

Setting this property raises an exception if the receiver’s model has been used by an object graph manager.

Import Statement

import CoreData

Availability

Declaration

Discussion

A property name cannot be the same as any no-parameter method name of NSObject or NSManagedObject. Since there are hundreds of methods on NSObject which may conflict with property names, you should avoid very general words (like "font”, and “color”) and words or phrases that overlap with Cocoa paradigms (such as “isEditing” and “objectSpecifier”).

Special Considerations

Setting the name raises an exception if the receiver’s model has been used by an object graph manager.

Parameters

Discussion

The validationPredicates and validationWarnings arrays should contain the same number of elements, and corresponding elements should appear at the same index in each array.

Instead of implementing individual validation methods, you can use this method to provide a list of predicates that are evaluated against the managed objects and a list of corresponding error messages (which can be localized).

Special Considerations

This method raises an exception if the receiver’s model has been used by an object graph manager.

Declaration

Discussion

The version hash is used to uniquely identify a property based on its configuration. The version hash uses only values which affect the persistence of data and the user-defined versionHashModifier value. (The values which affect persistence are the name of the property, and the flags for isOptional, isTransient, and isReadOnly.) This value is stored as part of the version information in the metadata for stores, as well as a definition of a property involved in an NSPropertyMapping object.

Declaration

Discussion

This value is included in the version hash for the property. You use it to mark or denote a property as being a different “version” than another even if all of the values which affect persistence are equal. (Such a difference is important in cases where the attributes of a property are unchanged but the format or content of its data are changed.)

See Also

Declaration

Discussion

This is used to resolve naming conflicts between models. When creating an entity mapping between entities in two managed object models, a source entity property and a destination entity property that share the same identifier indicate that a property mapping should be configured to migrate from the source to the destination. If unset, the identifier will return the property's name.

Special Considerations

Import Statement

Availability

A Boolean value that indicates whether the property data should be written out in an external record file corresponding to the managed object.

Declaration

Swift

var storedInExternalRecord: Bool

Objective-C

@property(getter=isStoredInExternalRecord)BOOLstoredInExternalRecord

Discussion

YEStrue if the property data should be written out in an external record file corresponding to the managed object, otherwise NOfalse. For additional information, see Core Data Spotlight Integration Programming Guide.