I am working on a project with multiple storyboards. I want to implement state restoration in this project. I am having a problem linking the ViewControllers on second storyboard into the state restoration process.
encodeRestorableStateWithCoder:
& decodeRestorableStateWithCoder:
methods are invoked only for ViewControllers associated with the Main storyboard.
How do you link the ViewControllers in the second storyboard to the state restoration process?
A storyboard is meant to explain a story, not a saga. An app's storyboard can be easily divided into multiple storyboards, with each one representing an individual story.
Restore the App State Using View Controllers This sample preserves its state by saving the state of its view controller hierarchy. View controllers adopt the UIStateRestoring protocol, which defines methods for saving custom state information to an archive and restoring that information later.
When you load a class from the other storyboard you essentially need to start using the manual approach to state restoration. (aka Restoration Classes)
This means that the view controller you loaded on the second storyboard must have a restoration ID assigned and implement the UIViewControllerRestoration protocol.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With