Re: Bundle build setting that renames or compresses storyboards, xibs and nibs
Re: Bundle build setting that renames or compresses storyboards, xibs and nibs
- Subject: Re: Bundle build setting that renames or compresses storyboards, xibs and nibs
- From: Quincey Morris <email@hidden>
- Date: Tue, 01 Mar 2016 14:00:35 -0800
- Feedback-id: 167118m:167118agrif8a:167118sR1EPAFX3D:SMTPCORP
On Mar 1, 2016, at 12:43 , Alex Zavatone <email@hidden> wrote:
NSString *myFrameworkIdentifier = @"com.myCompany.testFramework"; NSString *myStoryboardName = @"Insert your storyboard's name here without the extension"; NSBundle *myBundle = [NSBundle bundleWithIdentifier:myFrameworkIdentifier]; UIStoryboard *storyboardInstance = [UIStoryboard storyboardWithName:myStoryboardName bundle:myBundle]; UIViewController *initialViewControllerInstance = [storyboardInstance instantiateInitialViewController];
FWIW, I don’t think I’d do it this way either, because it’s too fragile (specifying the framework via a string).
The *politest* API would be to implement the instantiation as a class method in a class that’s in the framework. That is, move the code that finds the correct bundle into the framework itself, along with the boilerplate that’s needed to get from storybordName + bundle to view controller.
If the class of the initial view controller is known outside the framework, that seems like a good class to put the class method into. Otherwise, you can invent a class simply to provide a namespace for the method (rather than writing a global function, which is what the method “really” is).
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden