Adding Undo Support for NSTextView
Mac text views support undo and redo for text editing without you having to write any code. All you have to do is set the text view’s allowsUndo
property to true, which you can set in the attributes inspector.
Select the Allows Undo checkbox to turn on the text view’s undo/redo support.