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

# canUndo

A Boolean value that indicates whether the manager has any actions to undo.

```
var canUndo: Bool { get }
```

## Discussion

<doc://com.apple.documentation/documentation/Swift/true> if the manager has any actions to undo, otherwise <doc://com.apple.documentation/documentation/Swift/false>.

The return value doesn’t mean you can safely invoke [`undo()`](/documentation/Foundation/UndoManager/undo()) or [`undoNestedGroup()`](/documentation/Foundation/UndoManager/undoNestedGroup())—you may have to close open undo groups first.

## See Also

[`-  registerUndoWithTarget:selector:object:`](/documentation/Foundation/UndoManager/registerUndo(withTarget:selector:object:))

Registers the selector of the specified target to implement a single undo operation that the target receives.

[`-  enableUndoRegistration`](/documentation/Foundation/UndoManager/enableUndoRegistration())

Enables the recording of undo operations.



---

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)