Resolver
public final class Resolver
A dependency injection registry that registers and resolves services.
-
The main
Resolver.Declaration
Swift
public static var main: Resolver -
The default scope
graph.Declaration
Swift
public static var defaultScope: Scope -
A boolean value to indicate whether to ensure thread safety while registering and resolving services or not. Defaults to
truethat means thread-safe. Sometimes, it is better to set it tofalsein a single-threaded environment or for services that are only going to be used in a single thread such as UI thread for performance reasons.Declaration
Swift
public var isAtomic: Bool -
Initializes a new instance of
Resolver.Declaration
Swift
public init(isAtomic: Bool = true)Parameters
isAtomicA boolean value to indicate whether to ensure thread safety while registering and resolving services or not. Defaults to
truethat means thread-safe. -
Registers a service with one argument.
Declaration
Swift
@discardableResult public static func register<Service, Arg1>( _ type: Service.Type = Service.self, named name: String? = nil, scoped scope: Scope = defaultScope, factory: @escaping (Resolver, Arg1) -> Service ) -> ResolverParameters
typeThe type of a service. Defaults to the concrete type that is going to be initialized.
nameThe name of a service. Defaults to
nil.scopeThe scope of a service. Defaults to
defaultScope.factoryA factory method that creates a new instance of a service.
Return Value
The main
Resolver. -
Registers a service with two arguments.
Declaration
Swift
@discardableResult public static func register<Service, Arg1, Arg2>( _ type: Service.Type = Service.self, named name: String? = nil, scoped scope: Scope = defaultScope, factory: @escaping (Resolver, Arg1, Arg2) -> Service ) -> ResolverParameters
typeThe type of a service. Defaults to the concrete type that is going to be initialized.
nameThe name of a service. Defaults to
nil.scopeThe scope of a service. Defaults to
defaultScope.factoryA factory method that creates a new instance of a service.
Return Value
The main
Resolver. -
Registers a service with three arguments.
Declaration
Swift
@discardableResult public static func register<Service, Arg1, Arg2, Arg3>( _ type: Service.Type = Service.self, named name: String? = nil, scoped scope: Scope = defaultScope, factory: @escaping (Resolver, Arg1, Arg2, Arg3) -> Service ) -> ResolverParameters
typeThe type of a service. Defaults to the concrete type that is going to be initialized.
nameThe name of a service. Defaults to
nil.scopeThe scope of a service. Defaults to
defaultScope.factoryA factory method that creates a new instance of a service.
Return Value
The main
Resolver. -
Registers a service with four arguments.
Declaration
Swift
@discardableResult public static func register<Service, Arg1, Arg2, Arg3, Arg4>( _ type: Service.Type = Service.self, named name: String? = nil, scoped scope: Scope = defaultScope, factory: @escaping (Resolver, Arg1, Arg2, Arg3, Arg4) -> Service ) -> ResolverParameters
typeThe type of a service. Defaults to the concrete type that is going to be initialized.
nameThe name of a service. Defaults to
nil.scopeThe scope of a service. Defaults to
defaultScope.factoryA factory method that creates a new instance of a service.
Return Value
The main
Resolver. -
Registers a service with five arguments.
Declaration
Swift
@discardableResult public static func register<Service, Arg1, Arg2, Arg3, Arg4, Arg5>( _ type: Service.Type = Service.self, named name: String? = nil, scoped scope: Scope = defaultScope, factory: @escaping (Resolver, Arg1, Arg2, Arg3, Arg4, Arg5) -> Service ) -> ResolverParameters
typeThe type of a service. Defaults to the concrete type that is going to be initialized.
nameThe name of a service. Defaults to
nil.scopeThe scope of a service. Defaults to
defaultScope.factoryA factory method that creates a new instance of a service.
Return Value
The main
Resolver. -
Registers a service with six arguments.
Declaration
Swift
@discardableResult public static func register<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6>( _ type: Service.Type = Service.self, named name: String? = nil, scoped scope: Scope = defaultScope, factory: @escaping (Resolver, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) -> Service ) -> ResolverParameters
typeThe type of a service. Defaults to the concrete type that is going to be initialized.
nameThe name of a service. Defaults to
nil.scopeThe scope of a service. Defaults to
defaultScope.factoryA factory method that creates a new instance of a service.
Return Value
The main
Resolver. -
Registers a service with seven arguments.
Declaration
Swift
@discardableResult public static func register<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7>( _ type: Service.Type = Service.self, named name: String? = nil, scoped scope: Scope = defaultScope, factory: @escaping (Resolver, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) -> Service ) -> ResolverParameters
typeThe type of a service. Defaults to the concrete type that is going to be initialized.
nameThe name of a service. Defaults to
nil.scopeThe scope of a service. Defaults to
defaultScope.factoryA factory method that creates a new instance of a service.
Return Value
The main
Resolver. -
Registers a service with eight arguments.
Declaration
Swift
@discardableResult public static func register<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8>( _ type: Service.Type = Service.self, named name: String? = nil, scoped scope: Scope = defaultScope, factory: @escaping (Resolver, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8) -> Service ) -> ResolverParameters
typeThe type of a service. Defaults to the concrete type that is going to be initialized.
nameThe name of a service. Defaults to
nil.scopeThe scope of a service. Defaults to
defaultScope.factoryA factory method that creates a new instance of a service.
Return Value
The main
Resolver. -
Registers a service with nine arguments.
Declaration
Swift
@discardableResult public static func register<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9>( _ type: Service.Type = Service.self, named name: String? = nil, scoped scope: Scope = defaultScope, factory: @escaping (Resolver, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9) -> Service ) -> ResolverParameters
typeThe type of a service. Defaults to the concrete type that is going to be initialized.
nameThe name of a service. Defaults to
nil.scopeThe scope of a service. Defaults to
defaultScope.factoryA factory method that creates a new instance of a service.
Return Value
The main
Resolver. -
Registers a service with ten arguments.
Declaration
Swift
@discardableResult public static func register<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10>( _ type: Service.Type = Service.self, named name: String? = nil, scoped scope: Scope = defaultScope, factory: @escaping (Resolver, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10) -> Service ) -> ResolverParameters
typeThe type of a service. Defaults to the concrete type that is going to be initialized.
nameThe name of a service. Defaults to
nil.scopeThe scope of a service. Defaults to
defaultScope.factoryA factory method that creates a new instance of a service.
Return Value
The main
Resolver. -
Registers a service with one argument.
Declaration
Swift
@discardableResult public func register<Service, Arg1>( _ type: Service.Type = Service.self, named name: String? = nil, scoped scope: Scope = defaultScope, factory: @escaping (Resolver, Arg1) -> Service ) -> SelfParameters
typeThe type of a service. Defaults to the concrete type that is going to be initialized.
nameThe name of a service. Defaults to
nil.scopeThe scope of a service. Defaults to
defaultScope.factoryA factory method that creates a new instance of a service.
Return Value
The current instance of
Resolverregistering a service. -
Registers a service with two arguments.
Declaration
Swift
@discardableResult public func register<Service, Arg1, Arg2>( _ type: Service.Type = Service.self, named name: String? = nil, scoped scope: Scope = defaultScope, factory: @escaping (Resolver, Arg1, Arg2) -> Service ) -> SelfParameters
typeThe type of a service. Defaults to the concrete type that is going to be initialized.
nameThe name of a service. Defaults to
nil.scopeThe scope of a service. Defaults to
defaultScope.factoryA factory method that creates a new instance of a service.
Return Value
The current instance of
Resolverregistering a service. -
Registers a service with three arguments.
Declaration
Swift
@discardableResult public func register<Service, Arg1, Arg2, Arg3>( _ type: Service.Type = Service.self, named name: String? = nil, scoped scope: Scope = defaultScope, factory: @escaping (Resolver, Arg1, Arg2, Arg3) -> Service ) -> SelfParameters
typeThe type of a service. Defaults to the concrete type that is going to be initialized.
nameThe name of a service. Defaults to
nil.scopeThe scope of a service. Defaults to
defaultScope.factoryA factory method that creates a new instance of a service.
Return Value
The current instance of
Resolverregistering a service. -
Registers a service with four arguments.
Declaration
Swift
@discardableResult public func register<Service, Arg1, Arg2, Arg3, Arg4>( _ type: Service.Type = Service.self, named name: String? = nil, scoped scope: Scope = defaultScope, factory: @escaping (Resolver, Arg1, Arg2, Arg3, Arg4) -> Service ) -> SelfParameters
typeThe type of a service. Defaults to the concrete type that is going to be initialized.
nameThe name of a service. Defaults to
nil.scopeThe scope of a service. Defaults to
defaultScope.factoryA factory method that creates a new instance of a service.
Return Value
The current instance of
Resolverregistering a service. -
Registers a service with five arguments.
Declaration
Swift
@discardableResult public func register<Service, Arg1, Arg2, Arg3, Arg4, Arg5>( _ type: Service.Type = Service.self, named name: String? = nil, scoped scope: Scope = defaultScope, factory: @escaping (Resolver, Arg1, Arg2, Arg3, Arg4, Arg5) -> Service ) -> SelfParameters
typeThe type of a service. Defaults to the concrete type that is going to be initialized.
nameThe name of a service. Defaults to
nil.scopeThe scope of a service. Defaults to
defaultScope.factoryA factory method that creates a new instance of a service.
Return Value
The current instance of
Resolverregistering a service. -
Registers a service with six arguments.
Declaration
Swift
@discardableResult public func register<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6>( _ type: Service.Type = Service.self, named name: String? = nil, scoped scope: Scope = defaultScope, factory: @escaping (Resolver, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) -> Service ) -> SelfParameters
typeThe type of a service. Defaults to the concrete type that is going to be initialized.
nameThe name of a service. Defaults to
nil.scopeThe scope of a service. Defaults to
defaultScope.factoryA factory method that creates a new instance of a service.
Return Value
The current instance of
Resolverregistering a service. -
Registers a service with seven arguments.
Declaration
Swift
@discardableResult public func register<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7>( _ type: Service.Type = Service.self, named name: String? = nil, scoped scope: Scope = defaultScope, factory: @escaping (Resolver, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) -> Service ) -> SelfParameters
typeThe type of a service. Defaults to the concrete type that is going to be initialized.
nameThe name of a service. Defaults to
nil.scopeThe scope of a service. Defaults to
defaultScope.factoryA factory method that creates a new instance of a service.
Return Value
The current instance of
Resolverregistering a service. -
Registers a service with eight arguments.
Declaration
Swift
@discardableResult public func register<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8>( _ type: Service.Type = Service.self, named name: String? = nil, scoped scope: Scope = defaultScope, factory: @escaping (Resolver, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8) -> Service ) -> SelfParameters
typeThe type of a service. Defaults to the concrete type that is going to be initialized.
nameThe name of a service. Defaults to
nil.scopeThe scope of a service. Defaults to
defaultScope.factoryA factory method that creates a new instance of a service.
Return Value
The current instance of
Resolverregistering a service. -
Registers a service with nine arguments.
Declaration
Swift
@discardableResult public func register<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9>( _ type: Service.Type = Service.self, named name: String? = nil, scoped scope: Scope = defaultScope, factory: @escaping (Resolver, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9) -> Service ) -> SelfParameters
typeThe type of a service. Defaults to the concrete type that is going to be initialized.
nameThe name of a service. Defaults to
nil.scopeThe scope of a service. Defaults to
defaultScope.factoryA factory method that creates a new instance of a service.
Return Value
The current instance of
Resolverregistering a service. -
Registers a service with ten arguments.
Declaration
Swift
@discardableResult public func register<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10>( _ type: Service.Type = Service.self, named name: String? = nil, scoped scope: Scope = defaultScope, factory: @escaping (Resolver, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10) -> Service ) -> SelfParameters
typeThe type of a service. Defaults to the concrete type that is going to be initialized.
nameThe name of a service. Defaults to
nil.scopeThe scope of a service. Defaults to
defaultScope.factoryA factory method that creates a new instance of a service.
Return Value
The current instance of
Resolverregistering a service. -
Resolves a service with one argument registered in the main
Resolver.Declaration
Swift
public static func resolve<Service, Arg1>( _ type: Service.Type = Service.self, named name: String? = nil, arguments arg1: Arg1 ) -> Service?Parameters
typeThe type of a service. Defaults to the type inferred from the return type.
nameThe name of a service. Defaults to
nil.arg1The first argument of a service.
Return Value
An instance of a registered service or
nilif it is not registered. -
Resolves a service with two arguments registered in the main
Resolver.Declaration
Swift
public static func resolve<Service, Arg1, Arg2>( _ type: Service.Type = Service.self, named name: String? = nil, arguments arg1: Arg1, _ arg2: Arg2 ) -> Service?Parameters
typeThe type of a service. Defaults to the type inferred from the return type.
nameThe name of a service. Defaults to
nil.arg1The first argument of a service.
arg2The second argument of a service.
Return Value
An instance of a registered service or
nilif it is not registered. -
Resolves a service with three arguments registered in the main
Resolver.Declaration
Swift
public static func resolve<Service, Arg1, Arg2, Arg3>( _ type: Service.Type = Service.self, named name: String? = nil, arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3 ) -> Service?Parameters
typeThe type of a service. Defaults to the type inferred from the return type.
nameThe name of a service. Defaults to
nil.arg1The first argument of a service.
arg2The second argument of a service.
arg3The third argument of a service.
Return Value
An instance of a registered service or
nilif it is not registered. -
Resolves a service with four arguments registered in the main
Resolver.Declaration
Swift
public static func resolve<Service, Arg1, Arg2, Arg3, Arg4>( _ type: Service.Type = Service.self, named name: String? = nil, arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4 ) -> Service?Parameters
typeThe type of a service. Defaults to the type inferred from the return type.
nameThe name of a service. Defaults to
nil.arg1The first argument of a service.
arg2The second argument of a service.
arg3The third argument of a service.
arg4The fourth argument of a service.
Return Value
An instance of a registered service or
nilif it is not registered. -
Resolves a service with five arguments registered in the main
Resolver.Declaration
Swift
public static func resolve<Service, Arg1, Arg2, Arg3, Arg4, Arg5>( _ type: Service.Type = Service.self, named name: String? = nil, arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5 ) -> Service?Parameters
typeThe type of a service. Defaults to the type inferred from the return type.
nameThe name of a service. Defaults to
nil.arg1The first argument of a service.
arg2The second argument of a service.
arg3The third argument of a service.
arg4The fourth argument of a service.
arg5The fifth argument of a service.
Return Value
An instance of a registered service or
nilif it is not registered. -
Resolves a service with six arguments registered in the main
Resolver.Declaration
Swift
public static func resolve<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6>( _ type: Service.Type = Service.self, named name: String? = nil, arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5, _ arg6: Arg6 ) -> Service?Parameters
typeThe type of a service. Defaults to the type inferred from the return type.
nameThe name of a service. Defaults to
nil.arg1The first argument of a service.
arg2The second argument of a service.
arg3The third argument of a service.
arg4The fourth argument of a service.
arg5The fifth argument of a service.
arg6The sixth argument of a service.
Return Value
An instance of a registered service or
nilif it is not registered. -
Resolves a service with seven arguments registered in the main
Resolver.Declaration
Swift
public static func resolve<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7>( _ type: Service.Type = Service.self, named name: String? = nil, arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5, _ arg6: Arg6, _ arg7: Arg7 ) -> Service?Parameters
typeThe type of a service. Defaults to the type inferred from the return type.
nameThe name of a service. Defaults to
nil.arg1The first argument of a service.
arg2The second argument of a service.
arg3The third argument of a service.
arg4The fourth argument of a service.
arg5The fifth argument of a service.
arg6The sixth argument of a service.
arg7The seventh argument of a service.
Return Value
An instance of a registered service or
nilif it is not registered. -
Resolves a service with eight arguments registered in the main
Resolver.Declaration
Swift
public static func resolve<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8>( _ type: Service.Type = Service.self, named name: String? = nil, arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5, _ arg6: Arg6, _ arg7: Arg7, _ arg8: Arg8 ) -> Service?Parameters
typeThe type of a service. Defaults to the type inferred from the return type.
nameThe name of a service. Defaults to
nil.arg1The first argument of a service.
arg2The second argument of a service.
arg3The third argument of a service.
arg4The fourth argument of a service.
arg5The fifth argument of a service.
arg6The sixth argument of a service.
arg7The seventh argument of a service.
arg8The eighth argument of a service.
Return Value
An instance of a registered service or
nilif it is not registered. -
Resolves a service with nine arguments registered in the main
Resolver.Declaration
Swift
public static func resolve<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9>( _ type: Service.Type = Service.self, named name: String? = nil, arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5, _ arg6: Arg6, _ arg7: Arg7, _ arg8: Arg8, _ arg9: Arg9 ) -> Service?Parameters
typeThe type of a service. Defaults to the type inferred from the return type.
nameThe name of a service. Defaults to
nil.arg1The first argument of a service.
arg2The second argument of a service.
arg3The third argument of a service.
arg4The fourth argument of a service.
arg5The fifth argument of a service.
arg6The sixth argument of a service.
arg7The seventh argument of a service.
arg8The eighth argument of a service.
arg9The ninth argument of a service.
Return Value
An instance of a registered service or
nilif it is not registered. -
Resolves a service with ten arguments registered in the main
Resolver.Declaration
Swift
public static func resolve<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10>( _ type: Service.Type = Service.self, named name: String? = nil, arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5, _ arg6: Arg6, _ arg7: Arg7, _ arg8: Arg8, _ arg9: Arg9, _ arg10: Arg10 ) -> Service?Parameters
typeThe type of a service. Defaults to the type inferred from the return type.
nameThe name of a service. Defaults to
nil.arg1The first argument of a service.
arg2The second argument of a service.
arg3The third argument of a service.
arg4The fourth argument of a service.
arg5The fifth argument of a service.
arg6The sixth argument of a service.
arg7The seventh argument of a service.
arg8The eighth argument of a service.
arg9The ninth argument of a service.
arg10The tenth argument of a service.
Return Value
An instance of a registered service or
nilif it is not registered. -
Resolves a service with one argument.
Declaration
Swift
public func resolve<Service, Arg1>( _ type: Service.Type = Service.self, named name: String? = nil, arguments arg1: Arg1 ) -> Service?Parameters
typeThe type of a service. Defaults to the type inferred from the return type.
nameThe name of a service. Defaults to
nil.arg1The first argument of a service.
Return Value
An instance of a registered service or
nilif it is not registered. -
Resolves a service with two arguments.
Declaration
Swift
public func resolve<Service, Arg1, Arg2>( _ type: Service.Type = Service.self, named name: String? = nil, arguments arg1: Arg1, _ arg2: Arg2 ) -> Service?Parameters
typeThe type of a service. Defaults to the type inferred from the return type.
nameThe name of a service. Defaults to
nil.arg1The first argument of a service.
arg2The second argument of a service.
Return Value
An instance of a registered service or
nilif it is not registered. -
Resolves a service with three arguments.
Declaration
Swift
public func resolve<Service, Arg1, Arg2, Arg3>( _ type: Service.Type = Service.self, named name: String? = nil, arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3 ) -> Service?Parameters
typeThe type of a service. Defaults to the type inferred from the return type.
nameThe name of a service. Defaults to
nil.arg1The first argument of a service.
arg2The second argument of a service.
arg3The third argument of a service.
Return Value
An instance of a registered service or
nilif it is not registered. -
Resolves a service with four arguments.
Declaration
Swift
public func resolve<Service, Arg1, Arg2, Arg3, Arg4>( _ type: Service.Type = Service.self, named name: String? = nil, arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4 ) -> Service?Parameters
typeThe type of a service. Defaults to the type inferred from the return type.
nameThe name of a service. Defaults to
nil.arg1The first argument of a service.
arg2The second argument of a service.
arg3The third argument of a service.
arg4The fourth argument of a service.
Return Value
An instance of a registered service or
nilif it is not registered. -
Resolves a service with five arguments.
Declaration
Swift
public func resolve<Service, Arg1, Arg2, Arg3, Arg4, Arg5>( _ type: Service.Type = Service.self, named name: String? = nil, arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5 ) -> Service?Parameters
typeThe type of a service. Defaults to the type inferred from the return type.
nameThe name of a service. Defaults to
nil.arg1The first argument of a service.
arg2The second argument of a service.
arg3The third argument of a service.
arg4The fourth argument of a service.
arg5The fifth argument of a service.
Return Value
An instance of a registered service or
nilif it is not registered. -
Resolves a service with six arguments.
Declaration
Swift
public func resolve<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6>( _ type: Service.Type = Service.self, named name: String? = nil, arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5, _ arg6: Arg6 ) -> Service?Parameters
typeThe type of a service. Defaults to the type inferred from the return type.
nameThe name of a service. Defaults to
nil.arg1The first argument of a service.
arg2The second argument of a service.
arg3The third argument of a service.
arg4The fourth argument of a service.
arg5The fifth argument of a service.
arg6The sixth argument of a service.
Return Value
An instance of a registered service or
nilif it is not registered. -
Resolves a service with seven arguments.
Declaration
Swift
public func resolve<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7>( _ type: Service.Type = Service.self, named name: String? = nil, arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5, _ arg6: Arg6, _ arg7: Arg7 ) -> Service?Parameters
typeThe type of a service. Defaults to the type inferred from the return type.
nameThe name of a service. Defaults to
nil.arg1The first argument of a service.
arg2The second argument of a service.
arg3The third argument of a service.
arg4The fourth argument of a service.
arg5The fifth argument of a service.
arg6The sixth argument of a service.
arg7The seventh argument of a service.
Return Value
An instance of a registered service or
nilif it is not registered. -
Resolves a service with eight arguments.
Declaration
Swift
public func resolve<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8>( _ type: Service.Type = Service.self, named name: String? = nil, arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5, _ arg6: Arg6, _ arg7: Arg7, _ arg8: Arg8 ) -> Service?Parameters
typeThe type of a service. Defaults to the type inferred from the return type.
nameThe name of a service. Defaults to
nil.arg1The first argument of a service.
arg2The second argument of a service.
arg3The third argument of a service.
arg4The fourth argument of a service.
arg5The fifth argument of a service.
arg6The sixth argument of a service.
arg7The seventh argument of a service.
arg8The eighth argument of a service.
Return Value
An instance of a registered service or
nilif it is not registered. -
Resolves a service with nine arguments.
Declaration
Swift
public func resolve<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9>( _ type: Service.Type = Service.self, named name: String? = nil, arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5, _ arg6: Arg6, _ arg7: Arg7, _ arg8: Arg8, _ arg9: Arg9 ) -> Service?Parameters
typeThe type of a service. Defaults to the type inferred from the return type.
nameThe name of a service. Defaults to
nil.arg1The first argument of a service.
arg2The second argument of a service.
arg3The third argument of a service.
arg4The fourth argument of a service.
arg5The fifth argument of a service.
arg6The sixth argument of a service.
arg7The seventh argument of a service.
arg8The eighth argument of a service.
arg9The ninth argument of a service.
Return Value
An instance of a registered service or
nilif it is not registered. -
Resolves a service with ten arguments.
Declaration
Swift
public func resolve<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10>( _ type: Service.Type = Service.self, named name: String? = nil, arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5, _ arg6: Arg6, _ arg7: Arg7, _ arg8: Arg8, _ arg9: Arg9, _ arg10: Arg10 ) -> Service?Parameters
typeThe type of a service. Defaults to the type inferred from the return type.
nameThe name of a service. Defaults to
nil.arg1The first argument of a service.
arg2The second argument of a service.
arg3The third argument of a service.
arg4The fourth argument of a service.
arg5The fifth argument of a service.
arg6The sixth argument of a service.
arg7The seventh argument of a service.
arg8The eighth argument of a service.
arg9The ninth argument of a service.
arg10The tenth argument of a service.
Return Value
An instance of a registered service or
nilif it is not registered. -
Registers a service in the main
Resolver.Declaration
Swift
@discardableResult public static func register<Service>( _ type: Service.Type = Service.self, named name: String? = nil, scoped scope: Scope = defaultScope, factory: @escaping (Resolver) -> Service ) -> ResolverParameters
typeThe type of a service. Defaults to the concrete type that is going to be initialized.
nameThe name of a service. Defaults to
nil.scopeThe scope of a service. Defaults to
defaultScope.factoryA factory method that creates a new instance of a service.
Return Value
The main
Resolver. -
Registers a service.
Declaration
Swift
@discardableResult public func register<Service>( _ type: Service.Type = Service.self, named name: String? = nil, scoped scope: Scope = defaultScope, factory: @escaping (Resolver) -> Service ) -> SelfParameters
typeThe type of a service. Defaults to the concrete type that is going to be initialized.
nameThe name of a service. Defaults to
nil.scopeThe scope of a service. Defaults to
defaultScope.factoryA factory method that creates a new instance of a service.
Return Value
The current instance of
Resolverregistering a service. -
Resets the main
Resolverand removes all registered services.Declaration
Swift
public func reset() -
Resolves a service registered in the main
Resolver.Declaration
Swift
public static func resolve<Service>( _ type: Service.Type = Service.self, named name: String? = nil ) -> Service?Parameters
typeThe type of a service. Defaults to the type inferred from the return type.
nameThe name of a service. Defaults to
nil.Return Value
An instance of a registered service or
nilif it is not registered. -
Resolves a service.
Declaration
Swift
public func resolve<Service>( _ type: Service.Type = Service.self, named name: String? = nil ) -> Service?Parameters
typeThe type of a service. Defaults to the type inferred from the return type.
nameThe name of a service. Defaults to
nil.Return Value
An instance of a registered service or
nilif it is not registered.
View on GitHub
Install in Dash