Scope
public enum Scope
All instances lifecycle is managed by IoC Container.
The scope
property specifies how to manage it.
-
Instantiated when an object graph is being created.
Declaration
Swift
case always
-
An instance managed by the Container used
strong
caching strategy. Once created, will not be re-instantiating.Declaration
Swift
case singleton
-
Is always created.
Declaration
Swift
case prototype
-
It is similar to
singleton
but usesweak
caching strategy. Naturally, if not referenced will be released on memory.However, if the specified type is a value-type like
struct
, it works the same as prototype.Declaration
Swift
case weak