undoManager
The undo manager for the document.
Declaration
var undoManager: UndoManager! { get set }Discussion
This property holds the document’s undo manager (an UndoManager object). Accessing this property lazily creates a default undo manager if a custom undo manager hasn’t been set.
The undo manager for the document is registered as an observer of various UndoManager notifications so that it can call updateChangeCount(_:) as the user makes undoable changes to the document. When a subclass sets this property and implements registers changes with it, it doesn’t need to call updateChangeCount(_:) directly or (more rarely) override hasUnsavedChanges.