Implementing Undo and Redo with the Command Design Pattern in Swift

Using UndoManager to create an Undoable History

Undo and redo are two common functions found in many apps and your users may expect it in your app as well. Whenever it’s possible to manipulate data, your users will be grateful when they can undo their errors. Imagine using Xcode without the possibility to undo your latest change or redo it again — it would be a horror!

This gif shows an example of how undo and redo work:
The three buttons “Red”, “Blue” and…



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store