<!--
{
  "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/UndoManager/undoNestedGroup()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSUndoManager(im)undoNestedGroup"
  },
  "title" : "undoNestedGroup()"
}
-->

# undoNestedGroup()

Performs the undo operations in the last undo group (whether top-level or nested), recording the operations on the redo stack as a single group.

```
func undoNestedGroup()
```

## Discussion

Raises an `NSInternalInconsistencyException` if any undo operations have been registered since the last [`enableUndoRegistration()`](/documentation/Foundation/UndoManager/enableUndoRegistration()) message.

This method posts an [`NSUndoManagerCheckpoint`](/documentation/Foundation/NSNotification/Name-swift.struct/NSUndoManagerCheckpoint) and [`NSUndoManagerWillUndoChange`](/documentation/Foundation/NSNotification/Name-swift.struct/NSUndoManagerWillUndoChange) before it performs the undo operation, and it posts an [`NSUndoManagerDidUndoChange`](/documentation/Foundation/NSNotification/Name-swift.struct/NSUndoManagerDidUndoChange) after it performs the undo operation.

---

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)