Instance Property


The undo manager for the document.


var undoManager: UndoManager! { get set }


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 has not 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 does not need to call updateChangeCount(_:) directly or (more rarely) override hasUnsavedChanges.

See Also

Tracking Changes and Autosaving

var hasUnsavedChanges: Bool

Returns whether the document has any unsaved changes.

func updateChangeCount(UIDocumentChangeKind)

Update the change counter by indicating the kind of change.

func changeCountToken(for: UIDocumentSaveOperation)

Overridden to return a change token for a specific save operation.

func updateChangeCount(withToken: Any, for: UIDocumentSaveOperation)

Overridden to update the change count with reference to a change-count token passed in by UIKit.

func autosave(completionHandler: ((Bool) -> Void)? = nil)

Called by UIKit to initiate automatic saving of documents with unsaved changes.