Swinject - Ambiguous reference to the participant

I am using Swinject in my application Swift 3. When i tried

let container = Container()
container.register(NetworkModeling.self) { _ in Network() }

I get an error

Ambiguous reference to member 'register(_:name:factory:)'

What is wrong here?

+4
source share
1 answer

I ran into the same problem and I think the compiler might be a little more verbose in this case.

Anyway, my problem was on my side, not in Swinject

Check the following:

  • NetworkModelingand Networkare visible in your registration area (they are publiceither internalin the same module. remember that swift3 introduced fileprivatemany other qualifiers, so make sure your identifiers are visible for the registration code.

  • , Network NetworkModeling. , Swinject factory

,

+8

Source: https://habr.com/ru/post/1656492/


All Articles