AliSoftware / Dip

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

Singleton unexpected behavior #202

Closed mkdk closed 5 years ago

mkdk commented 5 years ago

Hello, i'm stuck with strange problem. container.register(.singleton) { GPSManager() as GPSManagerProtocol } - this is how i do register my component. And after this, i do not understand why, but after resolve more then one module with command "try! container.resolve()" for each, i see that my singleton was created 2 times, and i have 2 instances for my singleton object. It create two instance, but there must only one! Please help me what did i miss?