AliSoftware/Dip

Singleton unexpected behavior

mkdk opened this issue · 0 comments

mkdk commented

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?