0001 // 0002 // ObjectScope.swift 0003 // Swinject 0004 // 0005 // Created by Yoichi Tagaya on 7/24/15. 0006 // Copyright © 2015 Swinject Contributors. All rights reserved. 0007 // 0008 0009 /// A configuration how an instance provided by a `Container` is shared in the system. 0010 /// The configuration is ignored if it is applied to a value type. 0011 /// 0012 /// **Cases:** 0013 /// 0014 /// - None 0015 /// - Graph 0016 /// - Container 0017 /// - Hierarchy 0018 public enum ObjectScope{ 0019 /// A new instance is always created by the `Container` when a type is resolved. 0020 /// The instance is not shared. (aka Transient scope.) 0021 case None
ServiceEntry.swift:20 internal var objectScope = ObjectScope.GraphServiceEntry.swift:41 public func inObjectScope(objectScope: ObjectScope) -> Self {0022 0023 /// Instances are shared only when an object graph is being created, 0024 /// otherwise a new instance is created by the `Container`. This is the default scope. 0025 case Graph
Container.swift:149 case .None, .Graph:Container.swift:187 let usesPool = entry.objectScope != .None0026 0027 /// An instance provided by the `Container` is shared within the `Container`. (aka Singleton scope in the `Container`.) 0028 case Container
Container.swift:149 case .None, .Graph:ServiceEntry.swift:20 internal var objectScope = ObjectScope.Graph0029 0030 /// An instance provided by the `Container` is not only shared within the `Container` but also shared within its child `Containers`. 0031 case Hierarchy
Container.swift:151 case .Container:0032 } 0033
Container.swift:164 case .Hierarchy: