---
title: "setActionIsDiscardable(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/undomanager/setactionisdiscardable(_:)"
---

# setActionIsDiscardable(_:)

Sets whether the next undo or redo action is discardable.

## Declaration

```swift
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

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 dictionary of the NSUndoManagerWillCloseUndoGroup.

## See Also

### Using discardable undo and redo actions

- [undoActionIsDiscardable](foundation/undomanager/undoactionisdiscardable.md)
- [redoActionIsDiscardable](foundation/undomanager/redoactionisdiscardable.md)
