<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/UndoManager/setActionIsDiscardable(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSUndoManager(im)setActionIsDiscardable:"
  },
  "title" : "setActionIsDiscardable(_:)"
}
-->

# setActionIsDiscardable(_:)

Sets whether the next undo or redo action is discardable.

```
func setActionIsDiscardable(_ discardable: Bool)
```

## Parameters

`discardable`

Specifies if the action is discardable. <doc://com.apple.documentation/documentation/Swift/true> if the next undo or redo action can be discarded; <doc://com.apple.documentation/documentation/Swift/false> otherwise.

## Discussion

Specifies that the latest undo action may be safely discarded when a document can not be saved for any reason.

An example might be an undo action that changes the viewable area of a document.

To find out if an undo group contains only discardable actions, look for the `NSUndoManagerGroupIsDiscardableKey` in the [`userInfo`](/documentation/Foundation/NSNotification/userInfo) dictionary of the [`NSUndoManagerWillCloseUndoGroup`](/documentation/Foundation/NSNotification/Name-swift.struct/NSUndoManagerWillCloseUndoGroup).

---

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)