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

# awake(fromSnapshotEvents:)

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

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

## Parameters

`flags`

A bit mask of [`didChangeValue(forKey:)`](/documentation/CoreData/NSManagedObject/didChangeValue(forKey:)) constants to denote the event or events that led to the method being invoked.

    For possible values, see [`NSSnapshotEventType`](/documentation/CoreData/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:)`](/documentation/CoreData/NSManagedObject/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.

---

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)