awake(fromSnapshotEvents:)
Provides an opportunity to add code into the life cycle of the managed object when fulfilling it from a snapshot.
Declaration
func awake(fromSnapshotEvents flags: NSSnapshotEventType)Parameters
- flags:
A bit mask of Didchangevalue(forkey:) constants to denote the event or events that led to the method being invoked.
For possible values, see Nssnapshoteventtype.
Discussion
You typically use this method to compute derived values or to recreate transient relationships from the receiver’s persistent properties.
If you want to set attribute values and need to avoid emitting key-value observation change notifications, you should use primitive accessor methods (either setPrimitiveValue(_:forKey:) or—better—the appropriate custom primitive accessors). This ensures that the new values are treated as baseline values rather than being recorded as undoable changes for the properties in question.