Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Loading Swift Main Storyboard and View Controller from Framework

I would like to have my Swift Project load it's main Storyboard and View Controller from a Framework rather than the project itself.

Is this possible?

All help welcome.

like image 448
JohnMoll Avatar asked Nov 30 '25 00:11

JohnMoll


1 Answers

I'm sure you have long since resolved your issue, but posting the answer here in case it's useful to someone else coming across it from Google.

You can specify another storyboard as the main storyboard by selecting your project from the navigator, selecting the app target from the left panel and going into the 'Info' tab. There is a setting there for "Main storyboard base file name."

For your specific issue, that's probably not what you want though. Instead, open your app's Main.storyboard, highlight the view controller, open the Identity Inspector, and set the Class to the one from your framework. To get this to work for my project, I actually had to delete the existing Main.storyboard, create a new one, drop a View Controller on it, and set "Is Initial View Controller" from the Attributes Inspector first.

like image 76
Tres Avatar answered Dec 02 '25 15:12

Tres



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!