Type Property


Returns whether the receiving subclass of NSDocument supports autosaving of drafts.


class var autosavesDrafts: Bool { get }

Return Value

true if the receiving subclass of NSDocument supports autosaving of drafts; otherwise false.


The system expects that an NSDocument subclass that returns true from this method can properly handle save operations that use the NSDocument.SaveOperationType.autosaveAsOperation save operation type.

The default implementation of this method returns true for apps linked on or after OS X v10.8, and returns no for apps linked against earlier versions of macOS.

To opt out of autosaving in your NSDocument subclass when linking on or after OS X v10.8, override this method to return false.

When linking against a macOS version prior to 10.8, you can declare that your NSDocument subclass supports autosaving by overriding this method to return true.

AppKit invokes this method at various times. For example, when the updateChangeCount(_:) method is called with NSDocument.ChangeType.changeDone but without the NSDocument.ChangeType.changeDiscardable change type, NSDocument will the next autosave to use NSDocument.SaveOperationType.autosaveAsOperation and return the document into a draft.

Do not invoke this method to find out whether autosaving of a draft will be done.

See Also


func checkAutosavingSafety()

Returns a Boolean value indicating whether it is probably safe to autosave document changes.

func scheduleAutosaving()

Schedules periodic autosaving for the purpose of crash protection.

var hasUnautosavedChanges: Bool

A Boolean value indicating whether the document has changes that have not been autosaved.

func autosave(withImplicitCancellability: Bool, completionHandler: (Error?) -> Void)

Autosaves the document’s contents at an appropriate location if it needs autosaving.

class var autosavesInPlace: Bool

Returns whether the receiver supports autosaving in place.

class var preservesVersions: Bool

Returns whether the receiving subclass of NSDocument supports Versions.

func browseVersions(Any?)

Opens the Versions browser in the document’s main window.

var autosavingFileType: String?

Returns the document type that should be used for an autosave operation.

var autosavingIsImplicitlyCancellable: Bool

A Boolean value indicating whether autosaving is happening now but could be safely cancelled.

var autosavedContentsFileURL: URL?

The location of the most recently autosaved document contents.