Jason K. Jason K. - 21 days ago 5
Objective-C Question

Programmatically get a Storyboard ID?

Trying to see if a UIViewController or UIView can identify it's Storyboard ID. So was hoping for:

UIViewController *aViewController;
NSString *storyboardID = aViewController.storyboard.id; //not an actual property


or:

NSString *storyboardID = [aViewController.storyboard valueForKey:@"storyboardId"]; //also not a working call


But no joy and couldn't find a similar solution online. Does anyone know if this is even possible?

Answer

You can use the restorationIdentifier, it's right above the Storyboard identifier and it's a UIViewController property.