---
title: beginUndoGrouping()
framework: foundation
role: symbol
role_heading: Instance Method
path: foundation/undomanager/beginundogrouping()
---

# beginUndoGrouping()

Marks the beginning of an undo group.

## Declaration

```swift
func beginUndoGrouping()
```

## Discussion

Discussion All individual undo operations before a subsequent endUndoGrouping() message are grouped together and reversed by a later undo() message. By default undo groups are begun automatically at the start of the event loop, but you can begin your own undo groups with this method, and nest them within other groups. This method posts an NSUndoManagerCheckpoint unless a top-level undo is in progress. It posts an NSUndoManagerDidOpenUndoGroup if a new group was successfully created.

## See Also

### Creating undo groups

- [endUndoGrouping()](foundation/undomanager/endundogrouping().md)
- [groupsByEvent](foundation/undomanager/groupsbyevent.md)
- [groupingLevel](foundation/undomanager/groupinglevel.md)
