Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 819
Wilson Avatar asked Dec 23 '16 15:12

Wilson


People also ask

What is Storyboard ID in Xcode?

The storyboard ID is a String field that you can use to create a new ViewController based on that storyboard ViewController.

How do I find the storyboard ID?

In the Storyboard, select the view controller that you want to instantiate in code. Make sure the yellow circle is highlighted, and click on the Identity Inspector. Set the custom class as well as the field called "Storyboard ID". You can use the class name as the Storyboard ID.


2 Answers

Use Storyboard ID will reuse the Storyboard ID as the Restoration ID for the Scene.

See how when you check Use Storyboard ID it prepopulates the RestorationID?

enter image description here

like image 93
Andy Obusek Avatar answered Oct 17 '22 23:10

Andy Obusek


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.

like image 20
badhanganesh Avatar answered Oct 17 '22 23:10

badhanganesh