Can we have a singleton from the container? I have a use case that I need always the same service reference from the container. Can I do this ?
Thanks
ObjectScope.Container is the singleton setting for Swinject.
container.register(AnimalType.self) { _ in Cat() }
.inObjectScope(.Container)
Refer to the following document for the details of the object scopes:
https://github.com/Swinject/Swinject/blob/master/Documentation/ObjectScopes.md
Thank you for trying Swinject and adding a star.
Most helpful comment
ObjectScope.Containeris the singleton setting for Swinject.Refer to the following document for the details of the object scopes:
https://github.com/Swinject/Swinject/blob/master/Documentation/ObjectScopes.md
Thank you for trying Swinject and adding a star.