The problem is, tuple - unlike function call does not infer argument names, so above call just becomes (Service2.Type, String, String, Int) and compiler is confused. I believe this change arrived in swift 3, we just didn't noticed because there were not tests for it.
So to break this ambiguity, I changed the api to use tuple in the arguments:
let s = container ~> (Service2.self, name: "MyService2", arguments: ("Arg1", 5))
This is obviously not ideal as it breaks away from the Swinject resolve api, but I don't see any other solution.
I wanted to make this non-breaking change and deprecate the old api but its signature is again interfering with the new one and I had to remove a call with two arguments.
While writing tests for operators I've noticed there is ambiguity when calling ~> infix operator with named service and 2 arguments:
Compiler is not sure whether to call:
or
The problem is, tuple - unlike function call does not infer argument names, so above call just becomes
(Service2.Type, String, String, Int)
and compiler is confused. I believe this change arrived in swift 3, we just didn't noticed because there were not tests for it.So to break this ambiguity, I changed the api to use tuple in the arguments:
This is obviously not ideal as it breaks away from the Swinject
resolve
api, but I don't see any other solution.I wanted to make this non-breaking change and deprecate the old api but its signature is again interfering with the new one and I had to remove a call with two arguments.
I welcome any feedback on this one.