<!--
{
  "availability" : [
    "iOS: 3.0.0 -",
    "iPadOS: 3.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.4.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSNotification/Name-swift.struct/NSManagedObjectContextDidSave",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@NSManagedObjectContextDidSaveNotification"
  },
  "title" : "NSManagedObjectContextDidSave"
}
-->

# NSManagedObjectContextDidSave

A notification that posts after a context finishes writing unsaved changes.

```
static let NSManagedObjectContextDidSave: NSNotification.Name
```

## Discussion

> Important:
> Use ``doc://com.apple.foundation/documentation/Foundation/NSNotification/Name-swift.struct/NSManagedObjectContextDidSaveObjectIDs`` instead of this notification.

This notification’s `object` is the saved context. Don’t peform any asynchronous work or block the calling thread. <doc://com.apple.documentation/documentation/CoreData/NSManagedObjectContext> posts notifications to the same thread that creates it.

The `userInfo` dictionary contains the inserted, updated, and deleted managed objects of the completed save. For the keys to access those objects, see <doc://com.apple.documentation/documentation/CoreData/NSManagedObjectContext/NotificationKey>. Don’t capture the dictionary’s contents.

To safely use the provided managed objects on the current thread, create a new context and use its <doc://com.apple.documentation/documentation/CoreData/NSManagedObjectContext/mergeChanges(fromContextDidSave:)> method to merge in the notification’s changes.

---

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)