Closed atomicbird closed 6 years ago
When you create your assembly, pass the Storyboard's container into the constructor like so:
let assembler = Assembler(container: SwinjectStoryboard.defaultContainer)
Thanks @mpdifran for the answer👍
I'm working on an app that uses Swinject via the
Assembly
approach to managing injection. I'm looking at adding support for storyboard injection.Since we're currently instantiating the window and main view controller from the storyboard, I think I need to use
SwinjectStoryboard.setup()
to manage storyboard injection. But thedefaultContainer
used there isn't the same as thecontainer
argument passed to myAssembly
subclass. Also,setup()
is called early enough that I don't think I can create my assembly objects beforesetup()
is called.Is there some way I can use SwinjectStoryboard to manage a dependency on an object that's created in an
Assembly
? It's possible I haven't grasped Swinject well enough to see the obvious approach here.