user26830
user26830

Reputation: 1079

Loading a storyboard from a framework

I'm creating a library with Cocoapods and Swift 1.2. I have a storyboard that I have to load in my library. Although, I am always getting this same error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'Main' in bundle`.

What I have tried:

I was although able to load the storyboard from my example project, put then I was only able to instantiate the initial view controller.

Trying to invoke storyboard!.instantiateViewControllerWithIdentifier(someIdentifier) from the initial view controller always resulted in the view controller not being found, although I can clearly see that there is a view controller with that identifier. How can I fix this issue?

Upvotes: 7

Views: 5701

Answers (1)

user26830
user26830

Reputation: 1079

Found the problem. Just silly but after deleting the Main.storyboard from the project, I didn't remove it from the project's settings. Trying to load it as the initial view controller. After changing the settings, UIStoryboard(name:"Main", bundle:NSBundle(forClass:self) just works properly.

Upvotes: 3

Related Questions