UIStateRestoring Protocol • Provide a Restoration Class (Optional) • Confirm to UIViewControllerRestoration Protocol (Optional) • Encode and Decode relevant Data
the view controller & subsequent controllers in hierarchy • Storyboard handles providing restoration class and reference to controller for restoration • If implemented without storyboard, provide restoration id, restoration class and controllers instance.
to recreate the view controller • Primary key of records • UI states e.g. Slider value, Button Selection • Its not user defaults nor data • Saved state can be lost • If data is a preference, don’t store it in state restoration archive • Don’t convert to data and encode
Does your app supports state restoration ? Get the ViewControllers Decode saved objects Finish App restoration Finish App Initialisation Run App NO YES UIKit appDelegate: applicationWillFinishLaunching: appDelegate: shouldRestoreApplicationState: viewController: withRestorationIdentifierPath viewController: decodeRestorableState appDelegate: didDecodeRestorableState