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

# groupsByEvent

A Boolean value that indicates whether the manager automatically creates undo groups around each pass of the run loop.

```
var groupsByEvent: Bool { get set }
```

## Discussion

<doc://com.apple.documentation/documentation/Swift/true> if the manager automatically creates undo groups around each pass of the run loop, otherwise <doc://com.apple.documentation/documentation/Swift/false>.

The default is <doc://com.apple.documentation/documentation/Swift/true>. If you turn automatic grouping off, you must close groups explicitly before invoking either [`undo()`](/documentation/Foundation/UndoManager/undo()) or [`undoNestedGroup()`](/documentation/Foundation/UndoManager/undoNestedGroup()).

---

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)