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

# NSUndoManagerWillCloseUndoGroup

Posted before an undo manager closes an undo group.

```
static let NSUndoManagerWillCloseUndoGroup: NSNotification.Name
```

## Discussion

This notification originates in the implementation of the [`endUndoGrouping()`](/documentation/Foundation/UndoManager/endUndoGrouping()) method.

The notification object is the [`UndoManager`](/documentation/Foundation/UndoManager) object. Prior to OS X v10.7 this notification didn’t contain a `userInfo` dictionary. In macOS 10.7 and later the userInfo dictionary may contain the [`NSUndoManagerWillCloseUndoGroup`](/documentation/Foundation/NSNotification/Name-swift.struct/NSUndoManagerWillCloseUndoGroup) key, with a `NSNumber` Boolean value of YES, if the undo group as a whole is discardable.

The system posts this notification on the actor, thread, or dispatch queue that calls [`endUndoGrouping()`](/documentation/Foundation/UndoManager/endUndoGrouping()).

---

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)