---
title: "windowWillReturnUndoManager(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nswindowdelegate/windowwillreturnundomanager(_:)"
---

# windowWillReturnUndoManager(_:)

Tells the delegate that the window’s undo manager has been requested. Returns the appropriate undo manager for the window.

## Declaration

```swift
@MainActor optional func windowWillReturnUndoManager(_ window: NSWindow) -> UndoManager?
```

## Parameters

- `window`: The window whose undo manager is being requested.

## Return Value

Return Value The appropriate undo manager for the specified window.

## Discussion

Discussion If this method is not implemented by the delegate, the window creates anUndoManager for window. Further, after a window creates its own undo manager, this method is never again called on the delegate.
