---
title: "awake(fromSnapshotEvents:)"
framework: coredata
role: symbol
role_heading: Instance Method
path: "coredata/nsmanagedobject/awake(fromsnapshotevents:)"
---

# awake(fromSnapshotEvents:)

Provides an opportunity to add code into the life cycle of the managed object when fulfilling it from a snapshot.

## Declaration

```swift
func awake(fromSnapshotEvents flags: NSSnapshotEventType)
```

## Parameters

- `flags`: A bit mask of doc://com.apple.coredata/documentation/CoreData/NSManagedObject/didChangeValue(forKey:) constants to denote the event or events that led to the method being invoked. For possible values, see doc://com.apple.coredata/documentation/CoreData/NSSnapshotEventType.

## Discussion

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. important: Subclasses must invoke super’s implementation before performing their own initialization.

## See Also

### Managing Change Events

- [contextShouldIgnoreUnmodeledPropertyChanges](coredata/nsmanagedobject/contextshouldignoreunmodeledpropertychanges.md)
- [awakeFromFetch()](coredata/nsmanagedobject/awakefromfetch().md)
- [awakeFromInsert()](coredata/nsmanagedobject/awakefrominsert().md)
- [changedValues()](coredata/nsmanagedobject/changedvalues().md)
- [changedValuesForCurrentEvent()](coredata/nsmanagedobject/changedvaluesforcurrentevent().md)
- [committedValues(forKeys:)](coredata/nsmanagedobject/committedvalues(forkeys:).md)
- [prepareForDeletion()](coredata/nsmanagedobject/preparefordeletion().md)
- [willSave()](coredata/nsmanagedobject/willsave().md)
- [didSave()](coredata/nsmanagedobject/didsave().md)
- [willTurnIntoFault()](coredata/nsmanagedobject/willturnintofault().md)
- [didTurnIntoFault()](coredata/nsmanagedobject/didturnintofault().md)
- [fetchRequest()](coredata/nsmanagedobject/fetchrequest().md)
