Skip to content

Dynamically resolve differently for same protocl #96

@jakubvano

Description

@jakubvano

From @gilgol on April 9, 2018 11:40

I'm trying to dynamically resolve a protocol ViewModeling that 2 different view models are conforming to..
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).

I believe the issue is with SwinjectStoryboard that 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?

Just realised it might be more appropriate as a stackoverflaw post, so here is a link to the post:
https://stackoverflow.com/questions/49732300/how-to-inject-the-right-viewmodel-to-a-single-viewcontroller

Copied from original issue: Swinject/Swinject#345

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions