---
title: "undoManager(for:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextviewdelegate/undomanager(for:)"
---

# undoManager(for:)

Returns the undo manager for the specified text view.

## Declaration

```swift
@MainActor optional func undoManager(for view: NSTextView) -> UndoManager?
```

## Parameters

- `view`: The text view whose undo manager should be returned.

## Return Value

Return Value The undo manager for view.

## Discussion

Discussion This method provides the flexibility to return a custom undo manager for the text view. Although NSTextView implements undo and redo for changes to text, applications may need a custom undo manager to handle interactions between changes to text and changes to other items in the application.
