AliSoftware / Dip

Simple Swift Dependency container. Use protocols to resolve your dependencies and avoid singletons / sharedInstances!
MIT License
978 stars 75 forks source link

Question: How to resolve all instances implementing a common protocol? #215

Closed mylemans closed 5 years ago

mylemans commented 5 years ago

At the moment, in a separate step, we resolve a specific set of protocols so they can perform additional configuration steps.

In the past when I developed on Windows I would just give all these services a common interface (protocol) that they would have to implement, and then I just had to get all instances implementing that interface. How would I go on reproducing such behaviour using Dip?

ilyapuchka commented 5 years ago

@mylemans in early days there was an idea to support multi-injection but we dropped it as the same result can be achieved with tags and map function (see https://github.com/AliSoftware/Dip/pull/39#issuecomment-177610238)