---
title: NSManagedObjectContextWillSave
framework: foundation
role: symbol
role_heading: Type Property
path: foundation/nsnotification/name-swift.struct/nsmanagedobjectcontextwillsave
---

# NSManagedObjectContextWillSave

A notification that posts before a context writes unsaved changes.

## Declaration

```swift
static let NSManagedObjectContextWillSave: NSNotification.Name
```

## Discussion

Discussion This notification’s object is the context that’s about to save. Only use the notification to operate on the in-process save operation. For example, to insert additional managed objects. Don’t peform any asynchronous work or block the calling thread. NSManagedObjectContext posts notifications to the same thread that creates it. There is no userInfo dictionary.

## See Also

### Core Data

- [NSManagedObjectContextDidSave](foundation/nsnotification/name-swift.struct/nsmanagedobjectcontextdidsave.md)
- [NSManagedObjectContextObjectsDidChange](foundation/nsnotification/name-swift.struct/nsmanagedobjectcontextobjectsdidchange.md)
- [NSPersistentStoreCoordinatorStoresDidChange](foundation/nsnotification/name-swift.struct/nspersistentstorecoordinatorstoresdidchange.md)
- [NSPersistentStoreCoordinatorStoresWillChange](foundation/nsnotification/name-swift.struct/nspersistentstorecoordinatorstoreswillchange.md)
- [NSPersistentStoreCoordinatorWillRemoveStore](foundation/nsnotification/name-swift.struct/nspersistentstorecoordinatorwillremovestore.md)
- [NSCoreDataCoreSpotlightDelegateIndexDidUpdate](foundation/nsnotification/name-swift.struct/nscoredatacorespotlightdelegateindexdidupdate.md)
- [NSManagedObjectContextDidMergeChangesObjectIDs](foundation/nsnotification/name-swift.struct/nsmanagedobjectcontextdidmergechangesobjectids.md)
- [NSManagedObjectContextDidSaveObjectIDs](foundation/nsnotification/name-swift.struct/nsmanagedobjectcontextdidsaveobjectids.md)
- [NSPersistentStoreRemoteChange](foundation/nsnotification/name-swift.struct/nspersistentstoreremotechange.md)
- [NSPersistentStoreDidImportUbiquitousContentChanges](foundation/nsnotification/name-swift.struct/nspersistentstoredidimportubiquitouscontentchanges.md)
