Search code examples
iosxcodeuiviewcontrollerstoryboard

What's the difference between "Storyboard ID" and "Use Storyboard ID" in xcode


I always only use Storyboard ID and never use the checkbox Use Storyboard ID so wondering when it is required to use the checkbox.

These options are located in the Identity Inspector at xcode

Thanks!

enter image description here


Solution

  • Restoration Identifier is used to restore state of your View Controller.

    If we want to implement app state restoration in our app, we must use restoration identifiers for the view controllers that we want to be restored.

    General rule for setting the restoration identifier is to use the string of the Storyboard Identifier. We can use a totally different meaningful string for Restoration ID if we want. However, it is always neat to just use same name that Storyboard uses.

    Checking the Use Storyboard Identifier on just copies the string from Storyboard Identifier to it and uses it.