You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

507 lines
26 KiB

2 years ago
  1. //
  2. // Copyright © 2019 Swinject Contributors. All rights reserved.
  3. //
  4. //
  5. // NOTICE:
  6. //
  7. // Container.Arguments.swift is generated from Container.Arguments.erb by ERB.
  8. // Do NOT modify Container.Arguments.swift directly.
  9. // Instead, modify Container.Arguments.erb and run `script/gencode` at the project root directory to generate the code.
  10. //
  11. import Foundation
  12. // MARK: - Registeration with Arguments
  13. extension Container {
  14. /// Adds a registration for the specified service with the factory closure to specify how the service is resolved with dependencies.
  15. ///
  16. /// - Parameters:
  17. /// - serviceType: The service type to register.
  18. /// - name: A registration name, which is used to differentiate from other registrations
  19. /// that have the same service and factory types.
  20. /// - factory: The closure to specify how the service type is resolved with the dependencies of the type.
  21. /// It is invoked when the `Container` needs to instantiate the instance.
  22. /// It takes a `Resolver` instance and 1 argument to inject dependencies to the instance,
  23. /// and returns the instance of the component type for the service.
  24. ///
  25. /// - Returns: A registered `ServiceEntry` to configure more settings with method chaining.
  26. @discardableResult
  27. public func register<Service, Arg1>(
  28. _ serviceType: Service.Type,
  29. name: String? = nil,
  30. factory: @escaping (Resolver, Arg1) -> Service
  31. ) -> ServiceEntry<Service> {
  32. return _register(serviceType, factory: factory, name: name)
  33. }
  34. /// Adds a registration for the specified service with the factory closure to specify how the service is resolved with dependencies.
  35. ///
  36. /// - Parameters:
  37. /// - serviceType: The service type to register.
  38. /// - name: A registration name, which is used to differentiate from other registrations
  39. /// that have the same service and factory types.
  40. /// - factory: The closure to specify how the service type is resolved with the dependencies of the type.
  41. /// It is invoked when the `Container` needs to instantiate the instance.
  42. /// It takes a `Resolver` instance and 2 arguments to inject dependencies to the instance,
  43. /// and returns the instance of the component type for the service.
  44. ///
  45. /// - Returns: A registered `ServiceEntry` to configure more settings with method chaining.
  46. @discardableResult
  47. public func register<Service, Arg1, Arg2>(
  48. _ serviceType: Service.Type,
  49. name: String? = nil,
  50. factory: @escaping (Resolver, Arg1, Arg2) -> Service
  51. ) -> ServiceEntry<Service> {
  52. return _register(serviceType, factory: factory, name: name)
  53. }
  54. /// Adds a registration for the specified service with the factory closure to specify how the service is resolved with dependencies.
  55. ///
  56. /// - Parameters:
  57. /// - serviceType: The service type to register.
  58. /// - name: A registration name, which is used to differentiate from other registrations
  59. /// that have the same service and factory types.
  60. /// - factory: The closure to specify how the service type is resolved with the dependencies of the type.
  61. /// It is invoked when the `Container` needs to instantiate the instance.
  62. /// It takes a `Resolver` instance and 3 arguments to inject dependencies to the instance,
  63. /// and returns the instance of the component type for the service.
  64. ///
  65. /// - Returns: A registered `ServiceEntry` to configure more settings with method chaining.
  66. @discardableResult
  67. public func register<Service, Arg1, Arg2, Arg3>(
  68. _ serviceType: Service.Type,
  69. name: String? = nil,
  70. factory: @escaping (Resolver, Arg1, Arg2, Arg3) -> Service
  71. ) -> ServiceEntry<Service> {
  72. return _register(serviceType, factory: factory, name: name)
  73. }
  74. /// Adds a registration for the specified service with the factory closure to specify how the service is resolved with dependencies.
  75. ///
  76. /// - Parameters:
  77. /// - serviceType: The service type to register.
  78. /// - name: A registration name, which is used to differentiate from other registrations
  79. /// that have the same service and factory types.
  80. /// - factory: The closure to specify how the service type is resolved with the dependencies of the type.
  81. /// It is invoked when the `Container` needs to instantiate the instance.
  82. /// It takes a `Resolver` instance and 4 arguments to inject dependencies to the instance,
  83. /// and returns the instance of the component type for the service.
  84. ///
  85. /// - Returns: A registered `ServiceEntry` to configure more settings with method chaining.
  86. @discardableResult
  87. public func register<Service, Arg1, Arg2, Arg3, Arg4>(
  88. _ serviceType: Service.Type,
  89. name: String? = nil,
  90. factory: @escaping (Resolver, Arg1, Arg2, Arg3, Arg4) -> Service
  91. ) -> ServiceEntry<Service> {
  92. return _register(serviceType, factory: factory, name: name)
  93. }
  94. /// Adds a registration for the specified service with the factory closure to specify how the service is resolved with dependencies.
  95. ///
  96. /// - Parameters:
  97. /// - serviceType: The service type to register.
  98. /// - name: A registration name, which is used to differentiate from other registrations
  99. /// that have the same service and factory types.
  100. /// - factory: The closure to specify how the service type is resolved with the dependencies of the type.
  101. /// It is invoked when the `Container` needs to instantiate the instance.
  102. /// It takes a `Resolver` instance and 5 arguments to inject dependencies to the instance,
  103. /// and returns the instance of the component type for the service.
  104. ///
  105. /// - Returns: A registered `ServiceEntry` to configure more settings with method chaining.
  106. @discardableResult
  107. public func register<Service, Arg1, Arg2, Arg3, Arg4, Arg5>(
  108. _ serviceType: Service.Type,
  109. name: String? = nil,
  110. factory: @escaping (Resolver, Arg1, Arg2, Arg3, Arg4, Arg5) -> Service
  111. ) -> ServiceEntry<Service> {
  112. return _register(serviceType, factory: factory, name: name)
  113. }
  114. /// Adds a registration for the specified service with the factory closure to specify how the service is resolved with dependencies.
  115. ///
  116. /// - Parameters:
  117. /// - serviceType: The service type to register.
  118. /// - name: A registration name, which is used to differentiate from other registrations
  119. /// that have the same service and factory types.
  120. /// - factory: The closure to specify how the service type is resolved with the dependencies of the type.
  121. /// It is invoked when the `Container` needs to instantiate the instance.
  122. /// It takes a `Resolver` instance and 6 arguments to inject dependencies to the instance,
  123. /// and returns the instance of the component type for the service.
  124. ///
  125. /// - Returns: A registered `ServiceEntry` to configure more settings with method chaining.
  126. @discardableResult
  127. public func register<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6>(
  128. _ serviceType: Service.Type,
  129. name: String? = nil,
  130. factory: @escaping (Resolver, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) -> Service
  131. ) -> ServiceEntry<Service> {
  132. return _register(serviceType, factory: factory, name: name)
  133. }
  134. /// Adds a registration for the specified service with the factory closure to specify how the service is resolved with dependencies.
  135. ///
  136. /// - Parameters:
  137. /// - serviceType: The service type to register.
  138. /// - name: A registration name, which is used to differentiate from other registrations
  139. /// that have the same service and factory types.
  140. /// - factory: The closure to specify how the service type is resolved with the dependencies of the type.
  141. /// It is invoked when the `Container` needs to instantiate the instance.
  142. /// It takes a `Resolver` instance and 7 arguments to inject dependencies to the instance,
  143. /// and returns the instance of the component type for the service.
  144. ///
  145. /// - Returns: A registered `ServiceEntry` to configure more settings with method chaining.
  146. @discardableResult
  147. public func register<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7>(
  148. _ serviceType: Service.Type,
  149. name: String? = nil,
  150. factory: @escaping (Resolver, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) -> Service
  151. ) -> ServiceEntry<Service> {
  152. return _register(serviceType, factory: factory, name: name)
  153. }
  154. /// Adds a registration for the specified service with the factory closure to specify how the service is resolved with dependencies.
  155. ///
  156. /// - Parameters:
  157. /// - serviceType: The service type to register.
  158. /// - name: A registration name, which is used to differentiate from other registrations
  159. /// that have the same service and factory types.
  160. /// - factory: The closure to specify how the service type is resolved with the dependencies of the type.
  161. /// It is invoked when the `Container` needs to instantiate the instance.
  162. /// It takes a `Resolver` instance and 8 arguments to inject dependencies to the instance,
  163. /// and returns the instance of the component type for the service.
  164. ///
  165. /// - Returns: A registered `ServiceEntry` to configure more settings with method chaining.
  166. @discardableResult
  167. public func register<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8>(
  168. _ serviceType: Service.Type,
  169. name: String? = nil,
  170. factory: @escaping (Resolver, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8) -> Service
  171. ) -> ServiceEntry<Service> {
  172. return _register(serviceType, factory: factory, name: name)
  173. }
  174. /// Adds a registration for the specified service with the factory closure to specify how the service is resolved with dependencies.
  175. ///
  176. /// - Parameters:
  177. /// - serviceType: The service type to register.
  178. /// - name: A registration name, which is used to differentiate from other registrations
  179. /// that have the same service and factory types.
  180. /// - factory: The closure to specify how the service type is resolved with the dependencies of the type.
  181. /// It is invoked when the `Container` needs to instantiate the instance.
  182. /// It takes a `Resolver` instance and 9 arguments to inject dependencies to the instance,
  183. /// and returns the instance of the component type for the service.
  184. ///
  185. /// - Returns: A registered `ServiceEntry` to configure more settings with method chaining.
  186. @discardableResult
  187. public func register<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9>(
  188. _ serviceType: Service.Type,
  189. name: String? = nil,
  190. factory: @escaping (Resolver, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9) -> Service
  191. ) -> ServiceEntry<Service> {
  192. return _register(serviceType, factory: factory, name: name)
  193. }
  194. }
  195. // MARK: - Resolver with Arguments
  196. extension Container {
  197. /// Retrieves the instance with the specified service type and 1 argument to the factory closure.
  198. ///
  199. /// - Parameters:
  200. /// - serviceType: The service type to resolve.
  201. /// - argument: 1 argument to pass to the factory closure.
  202. ///
  203. /// - Returns: The resolved service type instance, or nil if no registration for the service type
  204. /// and 1 argument is found in the `Container`.
  205. public func resolve<Service, Arg1>(
  206. _ serviceType: Service.Type,
  207. argument: Arg1
  208. ) -> Service? {
  209. return resolve(serviceType, name: nil, argument: argument)
  210. }
  211. /// Retrieves the instance with the specified service type, 1 argument to the factory closure and registration name.
  212. ///
  213. /// - Parameters:
  214. /// - serviceType: The service type to resolve.
  215. /// - name: The registration name.
  216. /// - argument: 1 argument to pass to the factory closure.
  217. ///
  218. /// - Returns: The resolved service type instance, or nil if no registration for the service type,
  219. /// 1 argument and name is found in the `Container`.
  220. public func resolve<Service, Arg1>(
  221. _: Service.Type,
  222. name: String?,
  223. argument: Arg1
  224. ) -> Service? {
  225. typealias FactoryType = ((Resolver, Arg1)) -> Any
  226. return _resolve(name: name) { (factory: FactoryType) in factory((self, argument)) }
  227. }
  228. /// Retrieves the instance with the specified service type and list of 2 arguments to the factory closure.
  229. ///
  230. /// - Parameters:
  231. /// - serviceType: The service type to resolve.
  232. /// - arguments: List of 2 arguments to pass to the factory closure.
  233. ///
  234. /// - Returns: The resolved service type instance, or nil if no registration for the service type
  235. /// and list of 2 arguments is found in the `Container`.
  236. public func resolve<Service, Arg1, Arg2>(
  237. _ serviceType: Service.Type,
  238. arguments arg1: Arg1, _ arg2: Arg2
  239. ) -> Service? {
  240. return resolve(serviceType, name: nil, arguments: arg1, arg2)
  241. }
  242. /// Retrieves the instance with the specified service type, list of 2 arguments to the factory closure and registration name.
  243. ///
  244. /// - Parameters:
  245. /// - serviceType: The service type to resolve.
  246. /// - name: The registration name.
  247. /// - arguments: List of 2 arguments to pass to the factory closure.
  248. ///
  249. /// - Returns: The resolved service type instance, or nil if no registration for the service type,
  250. /// list of 2 arguments and name is found in the `Container`.
  251. public func resolve<Service, Arg1, Arg2>(
  252. _: Service.Type,
  253. name: String?,
  254. arguments arg1: Arg1, _ arg2: Arg2
  255. ) -> Service? {
  256. typealias FactoryType = ((Resolver, Arg1, Arg2)) -> Any
  257. return _resolve(name: name) { (factory: FactoryType) in factory((self, arg1, arg2)) }
  258. }
  259. /// Retrieves the instance with the specified service type and list of 3 arguments to the factory closure.
  260. ///
  261. /// - Parameters:
  262. /// - serviceType: The service type to resolve.
  263. /// - arguments: List of 3 arguments to pass to the factory closure.
  264. ///
  265. /// - Returns: The resolved service type instance, or nil if no registration for the service type
  266. /// and list of 3 arguments is found in the `Container`.
  267. public func resolve<Service, Arg1, Arg2, Arg3>(
  268. _ serviceType: Service.Type,
  269. arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3
  270. ) -> Service? {
  271. return resolve(serviceType, name: nil, arguments: arg1, arg2, arg3)
  272. }
  273. /// Retrieves the instance with the specified service type, list of 3 arguments to the factory closure and registration name.
  274. ///
  275. /// - Parameters:
  276. /// - serviceType: The service type to resolve.
  277. /// - name: The registration name.
  278. /// - arguments: List of 3 arguments to pass to the factory closure.
  279. ///
  280. /// - Returns: The resolved service type instance, or nil if no registration for the service type,
  281. /// list of 3 arguments and name is found in the `Container`.
  282. public func resolve<Service, Arg1, Arg2, Arg3>(
  283. _: Service.Type,
  284. name: String?,
  285. arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3
  286. ) -> Service? {
  287. typealias FactoryType = ((Resolver, Arg1, Arg2, Arg3)) -> Any
  288. return _resolve(name: name) { (factory: FactoryType) in factory((self, arg1, arg2, arg3)) }
  289. }
  290. /// Retrieves the instance with the specified service type and list of 4 arguments to the factory closure.
  291. ///
  292. /// - Parameters:
  293. /// - serviceType: The service type to resolve.
  294. /// - arguments: List of 4 arguments to pass to the factory closure.
  295. ///
  296. /// - Returns: The resolved service type instance, or nil if no registration for the service type
  297. /// and list of 4 arguments is found in the `Container`.
  298. public func resolve<Service, Arg1, Arg2, Arg3, Arg4>(
  299. _ serviceType: Service.Type,
  300. arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4
  301. ) -> Service? {
  302. return resolve(serviceType, name: nil, arguments: arg1, arg2, arg3, arg4)
  303. }
  304. /// Retrieves the instance with the specified service type, list of 4 arguments to the factory closure and registration name.
  305. ///
  306. /// - Parameters:
  307. /// - serviceType: The service type to resolve.
  308. /// - name: The registration name.
  309. /// - arguments: List of 4 arguments to pass to the factory closure.
  310. ///
  311. /// - Returns: The resolved service type instance, or nil if no registration for the service type,
  312. /// list of 4 arguments and name is found in the `Container`.
  313. public func resolve<Service, Arg1, Arg2, Arg3, Arg4>(
  314. _: Service.Type,
  315. name: String?,
  316. arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4
  317. ) -> Service? {
  318. typealias FactoryType = ((Resolver, Arg1, Arg2, Arg3, Arg4)) -> Any
  319. return _resolve(name: name) { (factory: FactoryType) in factory((self, arg1, arg2, arg3, arg4)) }
  320. }
  321. /// Retrieves the instance with the specified service type and list of 5 arguments to the factory closure.
  322. ///
  323. /// - Parameters:
  324. /// - serviceType: The service type to resolve.
  325. /// - arguments: List of 5 arguments to pass to the factory closure.
  326. ///
  327. /// - Returns: The resolved service type instance, or nil if no registration for the service type
  328. /// and list of 5 arguments is found in the `Container`.
  329. public func resolve<Service, Arg1, Arg2, Arg3, Arg4, Arg5>(
  330. _ serviceType: Service.Type,
  331. arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5
  332. ) -> Service? {
  333. return resolve(serviceType, name: nil, arguments: arg1, arg2, arg3, arg4, arg5)
  334. }
  335. /// Retrieves the instance with the specified service type, list of 5 arguments to the factory closure and registration name.
  336. ///
  337. /// - Parameters:
  338. /// - serviceType: The service type to resolve.
  339. /// - name: The registration name.
  340. /// - arguments: List of 5 arguments to pass to the factory closure.
  341. ///
  342. /// - Returns: The resolved service type instance, or nil if no registration for the service type,
  343. /// list of 5 arguments and name is found in the `Container`.
  344. public func resolve<Service, Arg1, Arg2, Arg3, Arg4, Arg5>(
  345. _: Service.Type,
  346. name: String?,
  347. arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5
  348. ) -> Service? {
  349. typealias FactoryType = ((Resolver, Arg1, Arg2, Arg3, Arg4, Arg5)) -> Any
  350. return _resolve(name: name) { (factory: FactoryType) in factory((self, arg1, arg2, arg3, arg4, arg5)) }
  351. }
  352. /// Retrieves the instance with the specified service type and list of 6 arguments to the factory closure.
  353. ///
  354. /// - Parameters:
  355. /// - serviceType: The service type to resolve.
  356. /// - arguments: List of 6 arguments to pass to the factory closure.
  357. ///
  358. /// - Returns: The resolved service type instance, or nil if no registration for the service type
  359. /// and list of 6 arguments is found in the `Container`.
  360. public func resolve<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6>(
  361. _ serviceType: Service.Type,
  362. arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5, _ arg6: Arg6
  363. ) -> Service? {
  364. return resolve(serviceType, name: nil, arguments: arg1, arg2, arg3, arg4, arg5, arg6)
  365. }
  366. /// Retrieves the instance with the specified service type, list of 6 arguments to the factory closure and registration name.
  367. ///
  368. /// - Parameters:
  369. /// - serviceType: The service type to resolve.
  370. /// - name: The registration name.
  371. /// - arguments: List of 6 arguments to pass to the factory closure.
  372. ///
  373. /// - Returns: The resolved service type instance, or nil if no registration for the service type,
  374. /// list of 6 arguments and name is found in the `Container`.
  375. public func resolve<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6>(
  376. _: Service.Type,
  377. name: String?,
  378. arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5, _ arg6: Arg6
  379. ) -> Service? {
  380. typealias FactoryType = ((Resolver, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)) -> Any
  381. return _resolve(name: name) { (factory: FactoryType) in factory((self, arg1, arg2, arg3, arg4, arg5, arg6)) }
  382. }
  383. /// Retrieves the instance with the specified service type and list of 7 arguments to the factory closure.
  384. ///
  385. /// - Parameters:
  386. /// - serviceType: The service type to resolve.
  387. /// - arguments: List of 7 arguments to pass to the factory closure.
  388. ///
  389. /// - Returns: The resolved service type instance, or nil if no registration for the service type
  390. /// and list of 7 arguments is found in the `Container`.
  391. public func resolve<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7>(
  392. _ serviceType: Service.Type,
  393. arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5, _ arg6: Arg6, _ arg7: Arg7
  394. ) -> Service? {
  395. return resolve(serviceType, name: nil, arguments: arg1, arg2, arg3, arg4, arg5, arg6, arg7)
  396. }
  397. /// Retrieves the instance with the specified service type, list of 7 arguments to the factory closure and registration name.
  398. ///
  399. /// - Parameters:
  400. /// - serviceType: The service type to resolve.
  401. /// - name: The registration name.
  402. /// - arguments: List of 7 arguments to pass to the factory closure.
  403. ///
  404. /// - Returns: The resolved service type instance, or nil if no registration for the service type,
  405. /// list of 7 arguments and name is found in the `Container`.
  406. public func resolve<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7>(
  407. _: Service.Type,
  408. name: String?,
  409. arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5, _ arg6: Arg6, _ arg7: Arg7
  410. ) -> Service? {
  411. typealias FactoryType = ((Resolver, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)) -> Any
  412. return _resolve(name: name) { (factory: FactoryType) in factory((self, arg1, arg2, arg3, arg4, arg5, arg6, arg7)) }
  413. }
  414. /// Retrieves the instance with the specified service type and list of 8 arguments to the factory closure.
  415. ///
  416. /// - Parameters:
  417. /// - serviceType: The service type to resolve.
  418. /// - arguments: List of 8 arguments to pass to the factory closure.
  419. ///
  420. /// - Returns: The resolved service type instance, or nil if no registration for the service type
  421. /// and list of 8 arguments is found in the `Container`.
  422. public func resolve<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8>(
  423. _ serviceType: Service.Type,
  424. arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5, _ arg6: Arg6, _ arg7: Arg7, _ arg8: Arg8
  425. ) -> Service? {
  426. return resolve(serviceType, name: nil, arguments: arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
  427. }
  428. /// Retrieves the instance with the specified service type, list of 8 arguments to the factory closure and registration name.
  429. ///
  430. /// - Parameters:
  431. /// - serviceType: The service type to resolve.
  432. /// - name: The registration name.
  433. /// - arguments: List of 8 arguments to pass to the factory closure.
  434. ///
  435. /// - Returns: The resolved service type instance, or nil if no registration for the service type,
  436. /// list of 8 arguments and name is found in the `Container`.
  437. public func resolve<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8>(
  438. _: Service.Type,
  439. name: String?,
  440. arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5, _ arg6: Arg6, _ arg7: Arg7, _ arg8: Arg8
  441. ) -> Service? {
  442. typealias FactoryType = ((Resolver, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)) -> Any
  443. return _resolve(name: name) { (factory: FactoryType) in factory((self, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)) }
  444. }
  445. /// Retrieves the instance with the specified service type and list of 9 arguments to the factory closure.
  446. ///
  447. /// - Parameters:
  448. /// - serviceType: The service type to resolve.
  449. /// - arguments: List of 9 arguments to pass to the factory closure.
  450. ///
  451. /// - Returns: The resolved service type instance, or nil if no registration for the service type
  452. /// and list of 9 arguments is found in the `Container`.
  453. public func resolve<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9>(
  454. _ serviceType: Service.Type,
  455. arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5, _ arg6: Arg6, _ arg7: Arg7, _ arg8: Arg8, _ arg9: Arg9
  456. ) -> Service? {
  457. return resolve(serviceType, name: nil, arguments: arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
  458. }
  459. /// Retrieves the instance with the specified service type, list of 9 arguments to the factory closure and registration name.
  460. ///
  461. /// - Parameters:
  462. /// - serviceType: The service type to resolve.
  463. /// - name: The registration name.
  464. /// - arguments: List of 9 arguments to pass to the factory closure.
  465. ///
  466. /// - Returns: The resolved service type instance, or nil if no registration for the service type,
  467. /// list of 9 arguments and name is found in the `Container`.
  468. public func resolve<Service, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9>(
  469. _: Service.Type,
  470. name: String?,
  471. arguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5, _ arg6: Arg6, _ arg7: Arg7, _ arg8: Arg8, _ arg9: Arg9
  472. ) -> Service? {
  473. typealias FactoryType = ((Resolver, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9)) -> Any
  474. return _resolve(name: name) { (factory: FactoryType) in factory((self, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)) }
  475. }
  476. }