---
title: undoManager
framework: swiftdata
role: symbol
role_heading: Instance Property
path: swiftdata/modelcontext/undomanager
---

# undoManager

The object that provides undo support for the context.

## Declaration

```swift
var undoManager: UndoManager? { get set }
```

## Discussion

Discussion Assign an instance of UndoManager to this property to enable undo support for the context. The undo manager can be exclusive to the context, or an existing manager should you want to integrate this context’s undo operations with those of the rest of your app. If the context does use an undo manager, improve performance by temporarily setting this property to nil when performing expensive operations, such as importing large numbers of models. The default value is nil.

## See Also

### Performing undo and redo

- [processPendingChanges()](swiftdata/modelcontext/processpendingchanges().md)
