UndoManager | Apple Developer Documentation
A general-purpose recorder of operations that enables undo and redo.