<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/UndoManager/WillCloseUndoGroupMessage",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:So13NSUndoManagerC10FoundationE25WillCloseUndoGroupMessageV"
  },
  "title" : "UndoManager.WillCloseUndoGroupMessage"
}
-->

# UndoManager.WillCloseUndoGroupMessage

A message that an undo manager sends before closing an undo group.

```
struct WillCloseUndoGroupMessage
```

## Overview

The undo manager posts this message after you call [`endUndoGrouping()`](/documentation/Foundation/UndoManager/endUndoGrouping()).
Because this is a “will”-style message, the undo manager sends the message before it closes the undo group.

Observe this message with the identifier [`willCloseUndoGroup`](/documentation/Foundation/NotificationCenter/MessageIdentifier/willCloseUndoGroup), or specify its type directly to the `addObserver(of:for:using:)` method.
The [`Subject`](/documentation/Foundation/NotificationCenter/MainActorMessage/Subject) of this message type is [`UndoManager`](/documentation/Foundation/UndoManager).

This message interoperates with the notification [`NSUndoManagerWillCloseUndoGroup`](/documentation/Foundation/NSNotification/Name-swift.struct/NSUndoManagerWillCloseUndoGroup).
The system notifies observers of the message when the [`NotificationCenter`](/documentation/Foundation/NotificationCenter) posts the notification.
Similarly, the system notifies observers of the notification when it posts the message.

## Topics

### Initializers

[`init()`](/documentation/Foundation/UndoManager/WillCloseUndoGroupMessage/init())

Creates a will close undo group message.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`MainActorMessage`](/documentation/Foundation/NotificationCenter/MainActorMessage)

---

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)