Search code examples
iosobjective-ctyphoon

Typhoon storyboard integration with manual assembly activation


I have a problem with Typhoon. I want to use storyboard integration, so I set the correct name of storyboard in plist and defined 'typhoonKey' runtime arguments for each view controller in storyboard. It works very well when I had assemblies activated throught plist integration. But my problem is that I want to manually activate assembly now because I have to setup MagicalRecord first (I want to inject model to view controller, and that model uses MagicalRecord).

In - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

method I called

TyphoonAssembly *viewControllersAssembly = [[ViewControllersAssembly new] activate];

but it doesn't work. It is possible to use typhoon storyboard integration with manually activated assembly?


Solution

  • You can manually instantiate a TyphoonStoryboard, and if you wish you can create a definition for this storyboard in your assembly. From here you can instantiate a view controller (probably the initial one) from that storyboard, and because its a TyphoonStoryboard dependencies will be injected.

    The drawback to this approach is that UIStateRestoration doesn't work as expected - this was the initial problem that led us to develop plist integration style of bootstrapping Typhoon.

    So you could:

    • Manually instantiate, as long as you don't need UIStateRestoration.
    • Look for another way to handle your life-cycle requirements.