On Mar 1, 2016, at 12:43 , Alex Zavatone <z...@mac.com> 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      (Xcode-users@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to