Closed nikans closed 6 years ago
You can't do register { ServiceImp1() as Service }
, it's a Swift limitation, not Dip. You can do register { ServiceImp1() }
but it will only register concrete type. You can try to apply type-arasure technique if it suites your case.
Take for example
Service
as a protocol with someassiciatedtype
s andServiceImp1: Service
andServiceImp2: Service
generic classes. I haven't tested yet, but a mind exercise tells me that it shouldn't work. Am I right?