Instance Method


Decodes and restores state-related information for the object.


optional func decodeRestorableState(with coder: NSCoder)



The coder object to use to decode the state of the view.


If your app supports state restoration, you can implement this method on any object for which you also overrode the encodeRestorableState(with:) method. Your implementation of this method should read any saved state information from the archive and use it to restore the object to its previous configuration. If your encodeRestorableState(with:) method called super, this method should similarly call super at some point in its implementation.

See Also

Encoding and Decoding the Object

func encodeRestorableState(with: NSCoder)

Encodes state-related information for the object.

func applicationFinishedRestoringState()

Called after all objects have had a chance to decode their state.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software