AliSoftware / Dip

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

Eager singletons recreated when using collaborating containers #180

Closed zintus closed 6 years ago

zintus commented 6 years ago

Hello and thanks for awesome project!

I'm using number of collaborating containers and i have Main service in one of them and Dependency service in other container, registered as .eagerSingleton.

When i'm resolving instance of Main from container where it's registered, new instance of Dependency is created, thus breaking .eagerSingleton contract. If i move all definitions to single container, everything works as expected.

ilyapuchka commented 6 years ago

@zintus can you submit a pr with failing test?

zintus commented 6 years ago

@ilyapuchka pulling issue details from memory i can't write test reproducing the issue.

Let's consider this closed for now.