Instance Property


Returns whether the document has any unsaved changes.


var hasUnsavedChanges: Bool { get }

Return Value

true if the document has unsaved changes, otherwise false.


The default implementation of autosave(completionHandler:) initiates a save if this method returns true. Typical subclasses do not need to override the hasUnsavedChanges method. To implement change tracking, they should instead use an UndoManager object (assigned to undoManager) to register changes or call updateChangeCount(_:) every time the user makes a change; UIKit then automatically determines whether there are unsaved changes.