I'm using Swinject for my DI solution, and extend it with the SwinjectStoryboard extension.
I'm struggling with dynamic injecting the right viewModel to a specific viewContoller. The specific scenario is as follow:
MyViewController has a property called var viewModel: ViewModeling.
There are 2 different view models that are conforming to the ViewModeling protocol, lets call them: firstViewModel and secondViewModel.
My storyboard contain just one controller and its the MyViewController.
The Issue
Inject the right viewModel as a dependancy of MyViewController dynamically (so only while running I'll know if to inject the first or the second)
I am able to do it on the service level (one protocol that 2 services are conforming to, and 2 different viewModel that each consume a different service can resolve the required one using a specific name)
I'm struggling with doing this on the viewController level, trying to inject the same view controller a specific viewModel (both conforms as mentioned to the same protocol).
Currently my hunch is that SwinjectStoryboard doesn't let me instantiate a view controller using its storyboard id (like I would normally do), and in addition define few different names that will be resolved on runtime.
Am I missing something?