Instance Method


Restores the interface-related state of the document.


func restoreState(with coder: NSCoder)



The coder object to use to restore the document’s interface-related state.


This method is part of the window restoration system and is called at launch time to restore the window-related state of your document object. The default implementation restores some basic information about the document. If you override this method, you must call super at some point in your implementation.

Subclasses can override this method and use it to restore the document-related information that was saved in the encodeRestorableState(with:) method. You can also use this method to reconfigure the document (or its associated window controller and window) to their previous appearance.

For information about using a coder object to read data from an archive, see Archives and Serializations Programming Guide.

See Also

Handling Window Restoration

func encodeRestorableState(with: NSCoder)

Saves the interface-related state of the document.

class var restorableStateKeyPaths: [String]

Returns an array of key paths that represent the restorable attributes of the document.

func invalidateRestorableState()

Marks the document’s interface-related state as dirty.

func restoreWindow(withIdentifier: NSUserInterfaceItemIdentifier, state: NSCoder, completionHandler: (NSWindow?, Error?) -> Void)

Restores a window that was associated with a document, after that document is reopened.