diff --git a/README.md b/README.md index 965631d..be958a0 100644 --- a/README.md +++ b/README.md @@ -221,6 +221,30 @@ container.register(Animal.self) { _ in Cat(name: "Mimi") } If you implicitly instantiate `UIWindow` and its root view controller, the registrations setup for "Main" storyboard can be shared with the referenced storyboard since `defaultContainer` is configured in `setup` method. +### Arguments +if you want to pass some arguments, you can do it in such way: + +1) Register VC +```swift +let container = SwinjectStoryboard.defaultContainer +container.storyboardInitCompletedArgs(AnimalViewController.self) { (r, c, arguments: (Int, SomeValue)) in + c.animal = r.resolve(Animal.self) + c.countAnimals = arguments.0 + c.someValue = arguments.1 +} +container.register(Animal.self) { _ in Cat(name: "Mimi") } +``` + +2) Resolve VC +```swift +let sb = SwinjectStoryboard.create( + name: "Animals", bundle: nil, container: container) +let firstArg: Int = 5 +let secondArg: SomeValue = SomeValue() +let catController = sb.instantiateViewController(withIdentifier: "SomeIdentifier", arguments: (firstArg, secondArg)) as! AnimalViewController +``` + + ## Credits SwinjectStoryboard is inspired by: diff --git a/Sources/SwinjectStoryboard.Arguments.erb b/Sources/SwinjectStoryboard.Arguments.erb new file mode 100644 index 0000000..5ed3643 --- /dev/null +++ b/Sources/SwinjectStoryboard.Arguments.erb @@ -0,0 +1,155 @@ +// +// Created by Andrew Ayers on 10/22/18 +// Copyright © 2018 Swinject Contributors. All rights reserved. +// + +// +// NOTICE: +// +// SwinjectStoryboard.Arguments.swift is generated from SwinjectStoryboard.Arguments.erb by ERB. +// Do NOT modify SwinjectStoryboard.Arguments.swift directly. +// Instead, modify SwinjectStoryboard.Arguments.erb and run `script/gencode` at the project root directory to generate the code. +// + +<% arg_count = 3 %> + +import Swinject +#if os(iOS) || os(tvOS) +extension SwinjectStoryboard { +<% (1..arg_count).each do |i| %> +<% arg_types = (1..i).map { |n| "Arg#{n}" }.join(", ") %> +<% arg_description = i == 1 ? "#{i} argument" : "#{i} arguments" %> + + private func injectDependency<<%= arg_types %>>(to viewController: UIViewController, arguments: (<%= arg_types %>) ) { + guard !viewController.wasInjected else { return } + defer { viewController.wasInjected = true } + + let registrationName = viewController.swinjectRegistrationName + + if let container = container.value as? _Resolver { + let option = SwinjectStoryboardOption(controllerType: type(of: viewController)) + typealias FactoryType = ((Resolver, Container.Controller, (<%= arg_types %>))) -> Any + let _ = container._resolve(name: registrationName, option: option) { (factory: FactoryType) in factory((self.container.value, viewController, arguments)) as Any } as Container.Controller? + } else { + fatalError("A type conforming Resolver protocol must conform _Resolver protocol too.") + } + + #if swift(>=4.2) + for child in viewController.children { + injectDependency(to: child, arguments: arguments) + } + #else + for child in viewController.childViewControllers { + injectDependency(to: child, arguments: arguments) + } + #endif + } +<% end %> + +<% (1..arg_count).each do |i| %> +<% arg_types = (1..i).map { |n| "Arg#{n}" }.join(", ") %> +<% arg_description = i == 1 ? "#{i} argument" : "#{i} arguments" %> + + public func instantiateViewController<<%= arg_types %>>(withIdentifier identifier: String, + arguments: (<%= arg_types %>)) -> UIViewController { + let viewController = loadViewController(with: identifier) + injectDependency(to: viewController, arguments: arguments) + return viewController + } + +<% end %> + + private func loadViewController(with identifier: String) -> UIViewController { + SwinjectStoryboard.pushInstantiatingStoryboard(self) + let viewController = super.instantiateViewController(withIdentifier: identifier) + SwinjectStoryboard.popInstantiatingStoryboard() + return viewController + } +} +#endif + +#if os(OSX) +extension SwinjectStoryboard { + <% (1..arg_count).each do |i| %> + <% arg_types = (1..i).map { |n| "Arg#{n}" }.join(", ") %> + <% arg_description = i == 1 ? "#{i} argument" : "#{i} arguments" %> + + private func injectDependency<<%= arg_types %>>(to viewController: NSViewController, arguments: (<%= arg_types %>) ) { + guard !viewController.wasInjected else { return } + defer { viewController.wasInjected = true } + + let registrationName = viewController.swinjectRegistrationName + + if let container = container.value as? _Resolver { + let option = SwinjectStoryboardOption(controllerType: type(of: viewController)) + typealias FactoryType = ((Resolver, Container.Controller, (<%= arg_types %>))) -> Any + let _ = container._resolve(name: registrationName, option: option) { (factory: FactoryType) in factory((self.container.value, viewController, arguments)) as Any } as Container.Controller? + } else { + fatalError("A type conforming Resolver protocol must conform _Resolver protocol too.") + } + + #if swift(>=4.2) + for child in viewController.children { + injectDependency(to: child, arguments: arguments) + } + #else + for child in viewController.childViewControllers { + injectDependency(to: child, arguments: arguments) + } + #endif + } + <% end %> + + <% (1..arg_count).each do |i| %> + <% arg_types = (1..i).map { |n| "Arg#{n}" }.join(", ") %> + <% arg_description = i == 1 ? "#{i} argument" : "#{i} arguments" %> + + public func instantiateController<<%= arg_types %>>(withIdentifier identifier: NSStoryboard.SceneIdentifier, + arguments: (<%= arg_types %>)) -> NSViewController { + let viewController = loadController(with: identifier) as! NSViewController + injectDependency(to: viewController, arguments: arguments) + return viewController + } + + <% end %> + + private func loadController(with identifier: NSStoryboard.SceneIdentifier) -> Any { + SwinjectStoryboard.pushInstantiatingStoryboard(self) + let viewController = super.instantiateController(withIdentifier: identifier) + SwinjectStoryboard.popInstantiatingStoryboard() + return viewController + } +} +#endif + +#if os(iOS) || os(OSX) || os(tvOS) +extension Container { +<% (1..arg_count).each do |i| %> +<% arg_types = (1..i).map { |n| "Arg#{n}" }.join(", ") %> +<% arg_description = i == 1 ? "#{i} argument" : "#{i} arguments" %> + /// Adds a registration of the specified view or window controller that is configured in a storyboard. + /// + /// - Note: Do NOT explicitly resolve the controller registered by this method. + /// The controller is intended to be resolved by `SwinjectStoryboard` implicitly. + /// + /// - Parameters: + /// - controllerType: The controller type to register as a service type. + /// The type is `UIViewController` in iOS, `NSViewController` or `NSWindowController` in OS X. + /// - name: A registration name, which is used to differenciate from other registrations + /// that have the same view or window controller type. + /// - initCompleted: A closure to specifiy how the dependencies of the view or window controller are injected. + /// It is invoked by the `Container` when the view or window controller is instantiated by `SwinjectStoryboard`. + + public func storyboardInitCompleted>(_ controllerType: C.Type, + name: String? = nil, initCompleted: @escaping (Resolver, C, (<%= arg_types %>)) -> ()) { + let factory = { (r: Resolver, c: Controller, arguments: (<%= arg_types %>)) -> Container.Controller in + initCompleted(r, c as! C, arguments) + return c + } + + let option = SwinjectStoryboardOption(controllerType: controllerType) + _register(Controller.self, factory: factory, name: name, option: option) + } +<% end %> +} +#endif diff --git a/Sources/SwinjectStoryboard.Arguments.swift b/Sources/SwinjectStoryboard.Arguments.swift new file mode 100644 index 0000000..073564e --- /dev/null +++ b/Sources/SwinjectStoryboard.Arguments.swift @@ -0,0 +1,312 @@ +// +// Created by Andrew Ayers on 10/22/18 +// Copyright © 2018 Swinject Contributors. All rights reserved. +// + +// +// NOTICE: +// +// SwinjectStoryboard.Arguments.swift is generated from SwinjectStoryboard.Arguments.erb by ERB. +// Do NOT modify SwinjectStoryboard.Arguments.swift directly. +// Instead, modify SwinjectStoryboard.Arguments.erb and run `script/gencode` at the project root directory to generate the code. +// + + +import Swinject +#if os(iOS) || os(tvOS) +extension SwinjectStoryboard { + + private func injectDependency(to viewController: UIViewController, arguments: (Arg1) ) { + guard !viewController.wasInjected else { return } + defer { viewController.wasInjected = true } + + let registrationName = viewController.swinjectRegistrationName + + if let container = container.value as? _Resolver { + let option = SwinjectStoryboardOption(controllerType: type(of: viewController)) + typealias FactoryType = ((Resolver, Container.Controller, (Arg1))) -> Any + let _ = container._resolve(name: registrationName, option: option) { (factory: FactoryType) in factory((self.container.value, viewController, arguments)) as Any } as Container.Controller? + } else { + fatalError("A type conforming Resolver protocol must conform _Resolver protocol too.") + } + + #if swift(>=4.2) + for child in viewController.children { + injectDependency(to: child, arguments: arguments) + } + #else + for child in viewController.childViewControllers { + injectDependency(to: child, arguments: arguments) + } + #endif + } + + private func injectDependency(to viewController: UIViewController, arguments: (Arg1, Arg2) ) { + guard !viewController.wasInjected else { return } + defer { viewController.wasInjected = true } + + let registrationName = viewController.swinjectRegistrationName + + if let container = container.value as? _Resolver { + let option = SwinjectStoryboardOption(controllerType: type(of: viewController)) + typealias FactoryType = ((Resolver, Container.Controller, (Arg1, Arg2))) -> Any + let _ = container._resolve(name: registrationName, option: option) { (factory: FactoryType) in factory((self.container.value, viewController, arguments)) as Any } as Container.Controller? + } else { + fatalError("A type conforming Resolver protocol must conform _Resolver protocol too.") + } + + #if swift(>=4.2) + for child in viewController.children { + injectDependency(to: child, arguments: arguments) + } + #else + for child in viewController.childViewControllers { + injectDependency(to: child, arguments: arguments) + } + #endif + } + + private func injectDependency(to viewController: UIViewController, arguments: (Arg1, Arg2, Arg3) ) { + guard !viewController.wasInjected else { return } + defer { viewController.wasInjected = true } + + let registrationName = viewController.swinjectRegistrationName + + if let container = container.value as? _Resolver { + let option = SwinjectStoryboardOption(controllerType: type(of: viewController)) + typealias FactoryType = ((Resolver, Container.Controller, (Arg1, Arg2, Arg3))) -> Any + let _ = container._resolve(name: registrationName, option: option) { (factory: FactoryType) in factory((self.container.value, viewController, arguments)) as Any } as Container.Controller? + } else { + fatalError("A type conforming Resolver protocol must conform _Resolver protocol too.") + } + + #if swift(>=4.2) + for child in viewController.children { + injectDependency(to: child, arguments: arguments) + } + #else + for child in viewController.childViewControllers { + injectDependency(to: child, arguments: arguments) + } + #endif + } + + + public func instantiateViewController(withIdentifier identifier: String, + arguments: (Arg1)) -> UIViewController { + let viewController = loadViewController(with: identifier) + injectDependency(to: viewController, arguments: arguments) + return viewController + } + + + public func instantiateViewController(withIdentifier identifier: String, + arguments: (Arg1, Arg2)) -> UIViewController { + let viewController = loadViewController(with: identifier) + injectDependency(to: viewController, arguments: arguments) + return viewController + } + + + public func instantiateViewController(withIdentifier identifier: String, + arguments: (Arg1, Arg2, Arg3)) -> UIViewController { + let viewController = loadViewController(with: identifier) + injectDependency(to: viewController, arguments: arguments) + return viewController + } + + + private func loadViewController(with identifier: String) -> UIViewController { + SwinjectStoryboard.pushInstantiatingStoryboard(self) + let viewController = super.instantiateViewController(withIdentifier: identifier) + SwinjectStoryboard.popInstantiatingStoryboard() + return viewController + } +} +#endif + +#if os(OSX) +extension SwinjectStoryboard { + + private func injectDependency(to viewController: NSViewController, arguments: (Arg1) ) { + guard !viewController.wasInjected else { return } + defer { viewController.wasInjected = true } + + let registrationName = viewController.swinjectRegistrationName + + if let container = container.value as? _Resolver { + let option = SwinjectStoryboardOption(controllerType: type(of: viewController)) + typealias FactoryType = ((Resolver, Container.Controller, (Arg1))) -> Any + let _ = container._resolve(name: registrationName, option: option) { (factory: FactoryType) in factory((self.container.value, viewController, arguments)) as Any } as Container.Controller? + } else { + fatalError("A type conforming Resolver protocol must conform _Resolver protocol too.") + } + + #if swift(>=4.2) + for child in viewController.children { + injectDependency(to: child, arguments: arguments) + } + #else + for child in viewController.childViewControllers { + injectDependency(to: child, arguments: arguments) + } + #endif + } + + private func injectDependency(to viewController: NSViewController, arguments: (Arg1, Arg2) ) { + guard !viewController.wasInjected else { return } + defer { viewController.wasInjected = true } + + let registrationName = viewController.swinjectRegistrationName + + if let container = container.value as? _Resolver { + let option = SwinjectStoryboardOption(controllerType: type(of: viewController)) + typealias FactoryType = ((Resolver, Container.Controller, (Arg1, Arg2))) -> Any + let _ = container._resolve(name: registrationName, option: option) { (factory: FactoryType) in factory((self.container.value, viewController, arguments)) as Any } as Container.Controller? + } else { + fatalError("A type conforming Resolver protocol must conform _Resolver protocol too.") + } + + #if swift(>=4.2) + for child in viewController.children { + injectDependency(to: child, arguments: arguments) + } + #else + for child in viewController.childViewControllers { + injectDependency(to: child, arguments: arguments) + } + #endif + } + + private func injectDependency(to viewController: NSViewController, arguments: (Arg1, Arg2, Arg3) ) { + guard !viewController.wasInjected else { return } + defer { viewController.wasInjected = true } + + let registrationName = viewController.swinjectRegistrationName + + if let container = container.value as? _Resolver { + let option = SwinjectStoryboardOption(controllerType: type(of: viewController)) + typealias FactoryType = ((Resolver, Container.Controller, (Arg1, Arg2, Arg3))) -> Any + let _ = container._resolve(name: registrationName, option: option) { (factory: FactoryType) in factory((self.container.value, viewController, arguments)) as Any } as Container.Controller? + } else { + fatalError("A type conforming Resolver protocol must conform _Resolver protocol too.") + } + + #if swift(>=4.2) + for child in viewController.children { + injectDependency(to: child, arguments: arguments) + } + #else + for child in viewController.childViewControllers { + injectDependency(to: child, arguments: arguments) + } + #endif + } + + + public func instantiateController(withIdentifier identifier: NSStoryboard.SceneIdentifier, + arguments: (Arg1)) -> NSViewController { + let viewController = loadController(with: identifier) as! NSViewController + injectDependency(to: viewController, arguments: arguments) + return viewController + } + + + public func instantiateController(withIdentifier identifier: NSStoryboard.SceneIdentifier, + arguments: (Arg1, Arg2)) -> NSViewController { + let viewController = loadController(with: identifier) as! NSViewController + injectDependency(to: viewController, arguments: arguments) + return viewController + } + + + public func instantiateController(withIdentifier identifier: NSStoryboard.SceneIdentifier, + arguments: (Arg1, Arg2, Arg3)) -> NSViewController { + let viewController = loadController(with: identifier) as! NSViewController + injectDependency(to: viewController, arguments: arguments) + return viewController + } + + + private func loadController(with identifier: NSStoryboard.SceneIdentifier) -> Any { + SwinjectStoryboard.pushInstantiatingStoryboard(self) + let viewController = super.instantiateController(withIdentifier: identifier) + SwinjectStoryboard.popInstantiatingStoryboard() + return viewController + } +} +#endif + +#if os(iOS) || os(OSX) || os(tvOS) +extension Container { + /// Adds a registration of the specified view or window controller that is configured in a storyboard. + /// + /// - Note: Do NOT explicitly resolve the controller registered by this method. + /// The controller is intended to be resolved by `SwinjectStoryboard` implicitly. + /// + /// - Parameters: + /// - controllerType: The controller type to register as a service type. + /// The type is `UIViewController` in iOS, `NSViewController` or `NSWindowController` in OS X. + /// - name: A registration name, which is used to differenciate from other registrations + /// that have the same view or window controller type. + /// - initCompleted: A closure to specifiy how the dependencies of the view or window controller are injected. + /// It is invoked by the `Container` when the view or window controller is instantiated by `SwinjectStoryboard`. + + public func storyboardInitCompleted(_ controllerType: C.Type, + name: String? = nil, initCompleted: @escaping (Resolver, C, (Arg1)) -> ()) { + let factory = { (r: Resolver, c: Controller, arguments: (Arg1)) -> Container.Controller in + initCompleted(r, c as! C, arguments) + return c + } + + let option = SwinjectStoryboardOption(controllerType: controllerType) + _register(Controller.self, factory: factory, name: name, option: option) + } + /// Adds a registration of the specified view or window controller that is configured in a storyboard. + /// + /// - Note: Do NOT explicitly resolve the controller registered by this method. + /// The controller is intended to be resolved by `SwinjectStoryboard` implicitly. + /// + /// - Parameters: + /// - controllerType: The controller type to register as a service type. + /// The type is `UIViewController` in iOS, `NSViewController` or `NSWindowController` in OS X. + /// - name: A registration name, which is used to differenciate from other registrations + /// that have the same view or window controller type. + /// - initCompleted: A closure to specifiy how the dependencies of the view or window controller are injected. + /// It is invoked by the `Container` when the view or window controller is instantiated by `SwinjectStoryboard`. + + public func storyboardInitCompleted(_ controllerType: C.Type, + name: String? = nil, initCompleted: @escaping (Resolver, C, (Arg1, Arg2)) -> ()) { + let factory = { (r: Resolver, c: Controller, arguments: (Arg1, Arg2)) -> Container.Controller in + initCompleted(r, c as! C, arguments) + return c + } + + let option = SwinjectStoryboardOption(controllerType: controllerType) + _register(Controller.self, factory: factory, name: name, option: option) + } + /// Adds a registration of the specified view or window controller that is configured in a storyboard. + /// + /// - Note: Do NOT explicitly resolve the controller registered by this method. + /// The controller is intended to be resolved by `SwinjectStoryboard` implicitly. + /// + /// - Parameters: + /// - controllerType: The controller type to register as a service type. + /// The type is `UIViewController` in iOS, `NSViewController` or `NSWindowController` in OS X. + /// - name: A registration name, which is used to differenciate from other registrations + /// that have the same view or window controller type. + /// - initCompleted: A closure to specifiy how the dependencies of the view or window controller are injected. + /// It is invoked by the `Container` when the view or window controller is instantiated by `SwinjectStoryboard`. + + public func storyboardInitCompleted(_ controllerType: C.Type, + name: String? = nil, initCompleted: @escaping (Resolver, C, (Arg1, Arg2, Arg3)) -> ()) { + let factory = { (r: Resolver, c: Controller, arguments: (Arg1, Arg2, Arg3)) -> Container.Controller in + initCompleted(r, c as! C, arguments) + return c + } + + let option = SwinjectStoryboardOption(controllerType: controllerType) + _register(Controller.self, factory: factory, name: name, option: option) + } +} +#endif diff --git a/Sources/SwinjectStoryboard.swift b/Sources/SwinjectStoryboard.swift index 807f508..3e41a8e 100644 --- a/Sources/SwinjectStoryboard.swift +++ b/Sources/SwinjectStoryboard.swift @@ -93,7 +93,7 @@ public class SwinjectStoryboard: _SwinjectStoryboardBase, SwinjectStoryboardProt return viewController } - private func injectDependency(to viewController: UIViewController) { + fileprivate func injectDependency(to viewController: UIViewController) { guard !viewController.wasInjected else { return } defer { viewController.wasInjected = true } @@ -105,6 +105,7 @@ public class SwinjectStoryboard: _SwinjectStoryboardBase, SwinjectStoryboardProt if let container = container.value as? _Resolver { let option = SwinjectStoryboardOption(controllerType: type(of: viewController)) typealias FactoryType = ((Resolver, Container.Controller)) -> Any + let _ = container._resolve(name: registrationName, option: option) { (factory: FactoryType) in factory((self.container.value, viewController)) as Any } as Container.Controller? } else { fatalError("A type conforming Resolver protocol must conform _Resolver protocol too.") diff --git a/SwinjectStoryboard.podspec b/SwinjectStoryboard.podspec index 9628b93..dc48aed 100644 --- a/SwinjectStoryboard.podspec +++ b/SwinjectStoryboard.podspec @@ -17,6 +17,6 @@ Pod::Spec.new do |s| s.ios.deployment_target = '8.0' s.osx.deployment_target = '10.10' s.tvos.deployment_target = '9.0' - s.dependency 'Swinject', '~> 2.5' + s.dependency 'Swinject', '~> 2.4' s.requires_arc = true end diff --git a/SwinjectStoryboard.xcodeproj/project.pbxproj b/SwinjectStoryboard.xcodeproj/project.pbxproj index a3663ee..cf14e06 100644 --- a/SwinjectStoryboard.xcodeproj/project.pbxproj +++ b/SwinjectStoryboard.xcodeproj/project.pbxproj @@ -7,6 +7,18 @@ objects = { /* Begin PBXBuildFile section */ + 55640989210FCFD600AFFA8F /* Swinject.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55640987210FCFCC00AFFA8F /* Swinject.framework */; }; + 5564098D21104F6200AFFA8F /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5564098B21104F6200AFFA8F /* Quick.framework */; }; + 5564098E21104F6200AFFA8F /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5564098C21104F6200AFFA8F /* Nimble.framework */; }; + 5564098F2110658E00AFFA8F /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5564098C21104F6200AFFA8F /* Nimble.framework */; }; + 556409902110658E00AFFA8F /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5564098B21104F6200AFFA8F /* Quick.framework */; }; + 556409912110658E00AFFA8F /* Swinject.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55640987210FCFCC00AFFA8F /* Swinject.framework */; }; + 556409922110664700AFFA8F /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5564098C21104F6200AFFA8F /* Nimble.framework */; }; + 556409932110664800AFFA8F /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5564098B21104F6200AFFA8F /* Quick.framework */; }; + 556409942110664800AFFA8F /* Swinject.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55640987210FCFCC00AFFA8F /* Swinject.framework */; }; + 556409952110664E00AFFA8F /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5564098C21104F6200AFFA8F /* Nimble.framework */; }; + 556409962110664E00AFFA8F /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5564098B21104F6200AFFA8F /* Quick.framework */; }; + 556409972110664E00AFFA8F /* Swinject.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55640987210FCFCC00AFFA8F /* Swinject.framework */; }; 983DFEA51CDB410D00D39731 /* Container+SwinjectStoryboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 983DFE9F1CDB410D00D39731 /* Container+SwinjectStoryboard.swift */; }; 983DFEA61CDB410D00D39731 /* Container+SwinjectStoryboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 983DFE9F1CDB410D00D39731 /* Container+SwinjectStoryboard.swift */; }; 983DFEA71CDB410D00D39731 /* Container+SwinjectStoryboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 983DFE9F1CDB410D00D39731 /* Container+SwinjectStoryboard.swift */; }; @@ -75,6 +87,10 @@ 98978E6A1DFC354B0046B966 /* UnavailableItems.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98978E671DFC354B0046B966 /* UnavailableItems.swift */; }; 98D562821CDB173500DECDC0 /* SwinjectStoryboard.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 98D562781CDB173500DECDC0 /* SwinjectStoryboard.framework */; }; 98D5629E1CDB19AB00DECDC0 /* SwinjectStoryboard.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 98D562941CDB19AB00DECDC0 /* SwinjectStoryboard.framework */; }; + A16CF79D217E4C0500800AA1 /* SwinjectStoryboard.Arguments.swift in Sources */ = {isa = PBXBuildFile; fileRef = A16CF79B217E4C0400800AA1 /* SwinjectStoryboard.Arguments.swift */; }; + A16CF79E217E4C0500800AA1 /* SwinjectStoryboard.Arguments.erb in Resources */ = {isa = PBXBuildFile; fileRef = A16CF79C217E4C0500800AA1 /* SwinjectStoryboard.Arguments.erb */; }; + A16CF79F217E51BC00800AA1 /* SwinjectStoryboard.Arguments.swift in Sources */ = {isa = PBXBuildFile; fileRef = A16CF79B217E4C0400800AA1 /* SwinjectStoryboard.Arguments.swift */; }; + A16CF7A0217E51BE00800AA1 /* SwinjectStoryboard.Arguments.swift in Sources */ = {isa = PBXBuildFile; fileRef = A16CF79B217E4C0400800AA1 /* SwinjectStoryboard.Arguments.swift */; }; CD2C63AA1D7864840075BC14 /* SwinjectStoryboard+StoryboardReference.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD2C63A91D7864840075BC14 /* SwinjectStoryboard+StoryboardReference.swift */; }; CD2C63AB1D7864840075BC14 /* SwinjectStoryboard+StoryboardReference.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD2C63A91D7864840075BC14 /* SwinjectStoryboard+StoryboardReference.swift */; }; CD2C63AD1D786C1F0075BC14 /* RelationshipReference1.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CD2C63AC1D786C1F0075BC14 /* RelationshipReference1.storyboard */; }; @@ -103,24 +119,6 @@ CD6073911EBB3E8C00BE2167 /* Storyboard1.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CD6073901EBB3E8C00BE2167 /* Storyboard1.storyboard */; }; CD6073931EBB3F1400BE2167 /* RelationshipReference2.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CD6073921EBB3F1400BE2167 /* RelationshipReference2.storyboard */; }; CD6073951EBB3F6200BE2167 /* RelationshipReference1.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CD6073941EBB3F6200BE2167 /* RelationshipReference1.storyboard */; }; - CDA864931EA9F17A00293FEC /* Swinject.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDA864921EA9F17A00293FEC /* Swinject.framework */; }; - CDA864951EA9F19400293FEC /* Swinject.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDA864941EA9F19400293FEC /* Swinject.framework */; }; - CDA864971EA9F1A000293FEC /* Swinject.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDA864961EA9F1A000293FEC /* Swinject.framework */; }; - CDA8649A1EA9F1B600293FEC /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDA864981EA9F1B600293FEC /* Nimble.framework */; }; - CDA8649B1EA9F1B600293FEC /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDA864991EA9F1B600293FEC /* Quick.framework */; }; - CDA864A41EA9F22900293FEC /* Nimble.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = CDA864981EA9F1B600293FEC /* Nimble.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - CDA864A51EA9F22900293FEC /* Quick.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = CDA864991EA9F1B600293FEC /* Quick.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - CDA864A81EA9F23200293FEC /* Swinject.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = CDA864921EA9F17A00293FEC /* Swinject.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - CDA864AB1EA9F25C00293FEC /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDA864AA1EA9F25C00293FEC /* Quick.framework */; }; - CDA864AE1EA9F27100293FEC /* Quick.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = CDA864AA1EA9F25C00293FEC /* Quick.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - CDA864B01EA9F27200293FEC /* Swinject.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = CDA864941EA9F19400293FEC /* Swinject.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - CDA864B21EA9F28E00293FEC /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDA864B11EA9F28E00293FEC /* Nimble.framework */; }; - CDA864B31EA9F29100293FEC /* Nimble.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = CDA864B11EA9F28E00293FEC /* Nimble.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - CDA864B61EA9F29E00293FEC /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDA864B41EA9F29E00293FEC /* Nimble.framework */; }; - CDA864B71EA9F29E00293FEC /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDA864B51EA9F29E00293FEC /* Quick.framework */; }; - CDA864B91EA9F2A600293FEC /* Nimble.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = CDA864B41EA9F29E00293FEC /* Nimble.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - CDA864BA1EA9F2A600293FEC /* Quick.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = CDA864B51EA9F29E00293FEC /* Quick.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - CDA864BB1EA9F2AA00293FEC /* Swinject.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = CDA864961EA9F1A000293FEC /* Swinject.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; FF492DA61EDA490F0081A4A7 /* SwinjectStoryboard+SetUp.m in Sources */ = {isa = PBXBuildFile; fileRef = FF492DA21EDA490F0081A4A7 /* SwinjectStoryboard+SetUp.m */; }; FF492DA71EDA490F0081A4A7 /* SwinjectStoryboard+SetUp.m in Sources */ = {isa = PBXBuildFile; fileRef = FF492DA21EDA490F0081A4A7 /* SwinjectStoryboard+SetUp.m */; }; FF492DA81EDA490F0081A4A7 /* SwinjectStoryboard+SetUp.m in Sources */ = {isa = PBXBuildFile; fileRef = FF492DA21EDA490F0081A4A7 /* SwinjectStoryboard+SetUp.m */; }; @@ -166,9 +164,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - CDA864A41EA9F22900293FEC /* Nimble.framework in CopyFiles */, - CDA864A51EA9F22900293FEC /* Quick.framework in CopyFiles */, - CDA864A81EA9F23200293FEC /* Swinject.framework in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -178,9 +173,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - CDA864B31EA9F29100293FEC /* Nimble.framework in CopyFiles */, - CDA864AE1EA9F27100293FEC /* Quick.framework in CopyFiles */, - CDA864B01EA9F27200293FEC /* Swinject.framework in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -190,15 +182,15 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - CDA864B91EA9F2A600293FEC /* Nimble.framework in CopyFiles */, - CDA864BA1EA9F2A600293FEC /* Quick.framework in CopyFiles */, - CDA864BB1EA9F2AA00293FEC /* Swinject.framework in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 55640987210FCFCC00AFFA8F /* Swinject.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Swinject.framework; path = Carthage/Build/iOS/Swinject.framework; sourceTree = ""; }; + 5564098B21104F6200AFFA8F /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = Carthage/Build/iOS/Quick.framework; sourceTree = ""; }; + 5564098C21104F6200AFFA8F /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = Carthage/Build/iOS/Nimble.framework; sourceTree = ""; }; 983DFE9F1CDB410D00D39731 /* Container+SwinjectStoryboard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Container+SwinjectStoryboard.swift"; sourceTree = ""; }; 983DFEA11CDB410D00D39731 /* SwinjectStoryboard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwinjectStoryboard.swift; sourceTree = ""; }; 983DFEA21CDB410D00D39731 /* SwinjectStoryboardOption.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwinjectStoryboardOption.swift; sourceTree = ""; }; @@ -258,6 +250,8 @@ 98D562CA1CDB1E8800DECDC0 /* tvOS-Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "tvOS-Base.xcconfig"; sourceTree = ""; }; 98D562CB1CDB1E8800DECDC0 /* tvOS-Framework.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "tvOS-Framework.xcconfig"; sourceTree = ""; }; 98D562CC1CDB1E8800DECDC0 /* tvOS-StaticLibrary.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "tvOS-StaticLibrary.xcconfig"; sourceTree = ""; }; + A16CF79B217E4C0400800AA1 /* SwinjectStoryboard.Arguments.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwinjectStoryboard.Arguments.swift; sourceTree = ""; }; + A16CF79C217E4C0500800AA1 /* SwinjectStoryboard.Arguments.erb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SwinjectStoryboard.Arguments.erb; sourceTree = ""; }; CD2C63A91D7864840075BC14 /* SwinjectStoryboard+StoryboardReference.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SwinjectStoryboard+StoryboardReference.swift"; sourceTree = ""; }; CD2C63AC1D786C1F0075BC14 /* RelationshipReference1.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = RelationshipReference1.storyboard; sourceTree = ""; }; CD2C63AE1D786CD70075BC14 /* RelationshipReference2.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = RelationshipReference2.storyboard; sourceTree = ""; }; @@ -281,15 +275,6 @@ CD6073901EBB3E8C00BE2167 /* Storyboard1.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Storyboard1.storyboard; sourceTree = ""; }; CD6073921EBB3F1400BE2167 /* RelationshipReference2.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = RelationshipReference2.storyboard; sourceTree = ""; }; CD6073941EBB3F6200BE2167 /* RelationshipReference1.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = RelationshipReference1.storyboard; sourceTree = ""; }; - CDA864921EA9F17A00293FEC /* Swinject.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Swinject.framework; path = Carthage/Build/iOS/Swinject.framework; sourceTree = ""; }; - CDA864941EA9F19400293FEC /* Swinject.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Swinject.framework; path = Carthage/Build/Mac/Swinject.framework; sourceTree = ""; }; - CDA864961EA9F1A000293FEC /* Swinject.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Swinject.framework; path = Carthage/Build/tvOS/Swinject.framework; sourceTree = ""; }; - CDA864981EA9F1B600293FEC /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = Carthage/Build/iOS/Nimble.framework; sourceTree = ""; }; - CDA864991EA9F1B600293FEC /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = Carthage/Build/iOS/Quick.framework; sourceTree = ""; }; - CDA864AA1EA9F25C00293FEC /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = Carthage/Build/Mac/Quick.framework; sourceTree = ""; }; - CDA864B11EA9F28E00293FEC /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = Carthage/Build/Mac/Nimble.framework; sourceTree = ""; }; - CDA864B41EA9F29E00293FEC /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = Carthage/Build/tvOS/Nimble.framework; sourceTree = ""; }; - CDA864B51EA9F29E00293FEC /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = Carthage/Build/tvOS/Quick.framework; sourceTree = ""; }; FF492DA21EDA490F0081A4A7 /* SwinjectStoryboard+SetUp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "SwinjectStoryboard+SetUp.m"; sourceTree = ""; }; FF492DAF1EDA65D90081A4A7 /* NSStoryboard+Swizzling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSStoryboard+Swizzling.h"; sourceTree = ""; }; FF492DB01EDA65D90081A4A7 /* NSStoryboard+Swizzling.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSStoryboard+Swizzling.m"; sourceTree = ""; }; @@ -303,7 +288,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - CDA864931EA9F17A00293FEC /* Swinject.framework in Frameworks */, + 5564098E21104F6200AFFA8F /* Nimble.framework in Frameworks */, + 5564098D21104F6200AFFA8F /* Quick.framework in Frameworks */, + 55640989210FCFD600AFFA8F /* Swinject.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -311,9 +298,10 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - CDA8649A1EA9F1B600293FEC /* Nimble.framework in Frameworks */, - CDA8649B1EA9F1B600293FEC /* Quick.framework in Frameworks */, 985904111CDB0AA700275E4A /* SwinjectStoryboard.framework in Frameworks */, + 5564098F2110658E00AFFA8F /* Nimble.framework in Frameworks */, + 556409902110658E00AFFA8F /* Quick.framework in Frameworks */, + 556409912110658E00AFFA8F /* Swinject.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -321,7 +309,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - CDA864951EA9F19400293FEC /* Swinject.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -329,9 +316,10 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - CDA864B21EA9F28E00293FEC /* Nimble.framework in Frameworks */, - CDA864AB1EA9F25C00293FEC /* Quick.framework in Frameworks */, 98D562821CDB173500DECDC0 /* SwinjectStoryboard.framework in Frameworks */, + 556409922110664700AFFA8F /* Nimble.framework in Frameworks */, + 556409932110664800AFFA8F /* Quick.framework in Frameworks */, + 556409942110664800AFFA8F /* Swinject.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -339,7 +327,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - CDA864971EA9F1A000293FEC /* Swinject.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -347,9 +334,10 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - CDA864B61EA9F29E00293FEC /* Nimble.framework in Frameworks */, - CDA864B71EA9F29E00293FEC /* Quick.framework in Frameworks */, 98D5629E1CDB19AB00DECDC0 /* SwinjectStoryboard.framework in Frameworks */, + 556409952110664E00AFFA8F /* Nimble.framework in Frameworks */, + 556409962110664E00AFFA8F /* Quick.framework in Frameworks */, + 556409972110664E00AFFA8F /* Swinject.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -455,6 +443,8 @@ 985904081CDB0AA700275E4A /* Sources */ = { isa = PBXGroup; children = ( + A16CF79C217E4C0500800AA1 /* SwinjectStoryboard.Arguments.erb */, + A16CF79B217E4C0400800AA1 /* SwinjectStoryboard.Arguments.swift */, 983DFEB91CDB414900D39731 /* iOS-tvOS */, 983DFEC01CDB415300D39731 /* OSX */, 983DFE9F1CDB410D00D39731 /* Container+SwinjectStoryboard.swift */, @@ -622,15 +612,9 @@ CDA864911EA9F17900293FEC /* Frameworks */ = { isa = PBXGroup; children = ( - CDA864B41EA9F29E00293FEC /* Nimble.framework */, - CDA864B51EA9F29E00293FEC /* Quick.framework */, - CDA864B11EA9F28E00293FEC /* Nimble.framework */, - CDA864AA1EA9F25C00293FEC /* Quick.framework */, - CDA864981EA9F1B600293FEC /* Nimble.framework */, - CDA864991EA9F1B600293FEC /* Quick.framework */, - CDA864961EA9F1A000293FEC /* Swinject.framework */, - CDA864941EA9F19400293FEC /* Swinject.framework */, - CDA864921EA9F17A00293FEC /* Swinject.framework */, + 5564098C21104F6200AFFA8F /* Nimble.framework */, + 5564098B21104F6200AFFA8F /* Quick.framework */, + 55640987210FCFCC00AFFA8F /* Swinject.framework */, ); name = Frameworks; sourceTree = ""; @@ -682,6 +666,7 @@ 985904021CDB0AA700275E4A /* Frameworks */, 985904031CDB0AA700275E4A /* Headers */, 985904041CDB0AA700275E4A /* Resources */, + 5564098A210FCFDF00AFFA8F /* ShellScript */, ); buildRules = ( ); @@ -850,6 +835,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + A16CF79E217E4C0500800AA1 /* SwinjectStoryboard.Arguments.erb in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -913,6 +899,28 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 5564098A210FCFDF00AFFA8F /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(SRCROOT)/Carthage/Build/iOS/Swinject.framework", + "$(SRCROOT)/Carthage/Build/iOS/Quick.framework", + "$(SRCROOT)/Carthage/Build/iOS/Nimble.framework", + ); + outputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Swinject.framework", + "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Quick.framework", + "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Nimble.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/usr/local/bin/carthage copy-frameworks"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 985904011CDB0AA700275E4A /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -927,6 +935,7 @@ 983DFEAB1CDB410D00D39731 /* SwinjectStoryboard.swift in Sources */, CD2C63AA1D7864840075BC14 /* SwinjectStoryboard+StoryboardReference.swift in Sources */, 983DFF0B1CDB440800D39731 /* Box.swift in Sources */, + A16CF79D217E4C0500800AA1 /* SwinjectStoryboard.Arguments.swift in Sources */, 983DFEBE1CDB414900D39731 /* _SwinjectStoryboardBase.m in Sources */, FF492DB71EDA65E30081A4A7 /* UIStoryboard+Swizzling.m in Sources */, 983DFEB41CDB410D00D39731 /* ViewController+Swinject.swift in Sources */, @@ -965,6 +974,7 @@ CD2C63B01D786D6B0075BC14 /* SwinjectStoryboard+StoryboardReference.swift in Sources */, 983DFEAC1CDB410D00D39731 /* SwinjectStoryboard.swift in Sources */, 983DFF0C1CDB440800D39731 /* Box.swift in Sources */, + A16CF79F217E51BC00800AA1 /* SwinjectStoryboard.Arguments.swift in Sources */, 983DFEC41CDB415300D39731 /* _SwinjectStoryboardBase.m in Sources */, 983DFEB51CDB410D00D39731 /* ViewController+Swinject.swift in Sources */, ); @@ -1003,6 +1013,7 @@ CD2C63AB1D7864840075BC14 /* SwinjectStoryboard+StoryboardReference.swift in Sources */, 983DFF0D1CDB440800D39731 /* Box.swift in Sources */, 983DFEBF1CDB414900D39731 /* _SwinjectStoryboardBase.m in Sources */, + A16CF7A0217E51BE00800AA1 /* SwinjectStoryboard.Arguments.swift in Sources */, FF492DB81EDA65E30081A4A7 /* UIStoryboard+Swizzling.m in Sources */, 983DFEB61CDB410D00D39731 /* ViewController+Swinject.swift in Sources */, ); @@ -1100,10 +1111,12 @@ "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/iOS", ); + GCC_TREAT_WARNINGS_AS_ERRORS = NO; INFOPLIST_FILE = Sources/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.el-eleven.SwinjectStoryboard"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_TREAT_WARNINGS_AS_ERRORS = NO; }; name = Debug; }; @@ -1119,9 +1132,11 @@ "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/iOS", ); + GCC_TREAT_WARNINGS_AS_ERRORS = NO; INFOPLIST_FILE = Sources/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.el-eleven.SwinjectStoryboard"; + SWIFT_TREAT_WARNINGS_AS_ERRORS = NO; }; name = Release; }; @@ -1135,6 +1150,7 @@ ); INFOPLIST_FILE = Tests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(FRAMEWORK_SEARCH_PATHS)"; PRODUCT_BUNDLE_IDENTIFIER = "com.el-eleven.SwinjectStoryboardTests"; PRODUCT_NAME = "$(PROJECT_NAME)Tests"; }; @@ -1150,6 +1166,7 @@ ); INFOPLIST_FILE = Tests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(FRAMEWORK_SEARCH_PATHS)"; PRODUCT_BUNDLE_IDENTIFIER = "com.el-eleven.SwinjectStoryboardTests"; PRODUCT_NAME = "$(PROJECT_NAME)Tests"; }; @@ -1199,8 +1216,10 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/Mac", + "$(PROJECT_DIR)/Carthage/Build/iOS", ); INFOPLIST_FILE = Tests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks $(FRAMEWORK_SEARCH_PATHS)"; MACOSX_DEPLOYMENT_TARGET = 10.11; PRODUCT_BUNDLE_IDENTIFIER = "com.el-eleven.SwinjectStoryboardTests"; PRODUCT_NAME = "$(PROJECT_NAME)Tests"; @@ -1214,8 +1233,10 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/Mac", + "$(PROJECT_DIR)/Carthage/Build/iOS", ); INFOPLIST_FILE = Tests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks $(FRAMEWORK_SEARCH_PATHS)"; MACOSX_DEPLOYMENT_TARGET = 10.11; PRODUCT_BUNDLE_IDENTIFIER = "com.el-eleven.SwinjectStoryboardTests"; PRODUCT_NAME = "$(PROJECT_NAME)Tests"; @@ -1271,8 +1292,10 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/tvOS", + "$(PROJECT_DIR)/Carthage/Build/iOS", ); INFOPLIST_FILE = Tests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(FRAMEWORK_SEARCH_PATHS)"; PRODUCT_BUNDLE_IDENTIFIER = "com.el-eleven.SwinjectStoryboardTests"; PRODUCT_NAME = "$(PROJECT_NAME)Tests"; }; @@ -1286,8 +1309,10 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/tvOS", + "$(PROJECT_DIR)/Carthage/Build/iOS", ); INFOPLIST_FILE = Tests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(FRAMEWORK_SEARCH_PATHS)"; PRODUCT_BUNDLE_IDENTIFIER = "com.el-eleven.SwinjectStoryboardTests"; PRODUCT_NAME = "$(PROJECT_NAME)Tests"; }; diff --git a/Tests/OSX/SwinjectStoryboardSpec.swift b/Tests/OSX/SwinjectStoryboardSpec.swift index 623f435..22868b5 100644 --- a/Tests/OSX/SwinjectStoryboardSpec.swift +++ b/Tests/OSX/SwinjectStoryboardSpec.swift @@ -198,6 +198,90 @@ class SwinjectStoryboardSpec: QuickSpec { SwinjectStoryboard.defaultContainer.removeAll() } } + describe("Arguments passed through instantiate view controller") { + it("should inject data passed into a view controller - 1 arg") { + guard let container = container else { + fail() + return + } + + container.storyboardInitCompleted(AnimalViewController.self) { (r, c, name: (String)) in + c.animal = r.resolve(Animal.self) + // Try to use the injected name argument to set a new name on the Cat + if let cat = c.animal as? Cat { + cat.name = name + } + } + container.register(Animal.self) { _ in Cat(name: "Mimi") } + let storyboard = SwinjectStoryboard.create(name: .animals, bundle: bundle, container: container) + // Instantiate the view controller, with an extra argument of a new name for the Cat. + let animalViewController = storyboard.instantiateController(withIdentifier: .animalView, arguments: "Whiskers") as! AnimalViewController + // Assert that the name was passed through correctly. + expect(animalViewController.hasAnimal(named: "Whiskers")) == true + } + it("should inject data passed into a view controller - 2 args") { + guard let container = container else { + fail() + return + } + + container.storyboardInitCompleted(AnimalViewController.self) { (r, c, arguments: (String, Bool)) in + c.animal = r.resolve(Animal.self) + // Try to use the injected name argument to set a new name on the Cat + if let cat = c.animal as? Cat { + let name = arguments.0 + let sleeping = arguments.1 + cat.name = name + cat.sleeping = sleeping + } + } + container.register(Animal.self) { _ in Cat(name: "Mimi") } + let storyboard = SwinjectStoryboard.create(name: .animals, bundle: bundle, container: container) + + // Instantiate the view controller, with an extra argument of a new name for the Cat, and a new sleeping param + let animalViewController = storyboard.instantiateController(withIdentifier: .animalView, arguments: ("Whiskers", true)) as! AnimalViewController + // Assert that extra context was passed through correctly. + expect(animalViewController.hasAnimal(named: "Whiskers")) == true + guard let cat = animalViewController.animal as? Cat else { + fail() + return + } + expect(cat.sleeping)==true + } + it("should inject data passed into a view controller - 3 args") { + guard let container = container else { + fail() + return + } + + container.storyboardInitCompleted(AnimalViewController.self) { (r, c, arguments: (String, Bool, Food)) in + c.animal = r.resolve(Animal.self) + // Try to use the injected name argument to set a new name on the Cat + if let cat = c.animal as? Cat { + cat.name = arguments.0 + cat.sleeping = arguments.1 + cat.favoriteFood = arguments.2 + } + } + container.register(Animal.self) { _ in Cat(name: "Mimi") } + let storyboard = SwinjectStoryboard.create(name: .animals, bundle: bundle, container: container) + + let arguments: (String, Bool, Food) = ("Whiskers", true, Sushi()) + // Instantiate the view controller, with an extra argument of a new name for the Cat. + let animalViewController = storyboard.instantiateController(withIdentifier: .animalView, arguments: arguments) as! AnimalViewController + // Assert that the name was passed through correctly. + expect(animalViewController.hasAnimal(named: "Whiskers")) == true + guard let cat = animalViewController.animal as? Cat else { + fail() + return + } + expect(cat.sleeping)==true + expect(cat.favoriteFood is Sushi) == true + } + afterEach { + SwinjectStoryboard.defaultContainer.removeAll() + } + } describe("Setup") { it("calls setup function only once.") { _ = SwinjectStoryboard.create(name: .animals, bundle: bundle) diff --git a/Tests/iOS-tvOS/SwinjectStoryboardSpec.swift b/Tests/iOS-tvOS/SwinjectStoryboardSpec.swift index 22cd1b8..ac3598e 100644 --- a/Tests/iOS-tvOS/SwinjectStoryboardSpec.swift +++ b/Tests/iOS-tvOS/SwinjectStoryboardSpec.swift @@ -189,6 +189,91 @@ class SwinjectStoryboardSpec: QuickSpec { } } } + describe("Arguments passed through instantiate view controller") { + it("should inject data passed into a view controller - 1 arg") { + guard let container = container else { + fail() + return + } + + container.storyboardInitCompleted(AnimalViewController.self) { (r, c, name: (String)) in + c.animal = r.resolve(Animal.self) + // Try to use the injected name argument to set a new name on the Cat + if let cat = c.animal as? Cat { + cat.name = name + } + } + container.register(Animal.self) { _ in Cat(name: "Mimi") } + let storyboard = SwinjectStoryboard.create(name: "Animals", bundle: bundle, container: container) + + // Instantiate the view controller, with an extra argument of a new name for the Cat. + let animalViewController = storyboard.instantiateViewController(withIdentifier: "AnimalAsCat", arguments: "Whiskers") as! AnimalViewController + // Assert that the name was passed through correctly. + expect(animalViewController.hasAnimal(named: "Whiskers")) == true + } + it("should inject data passed into a view controller - 2 args") { + guard let container = container else { + fail() + return + } + + container.storyboardInitCompleted(AnimalViewController.self) { (r, c, arguments: (String, Bool)) in + c.animal = r.resolve(Animal.self) + // Try to use the injected name argument to set a new name on the Cat + if let cat = c.animal as? Cat { + let name = arguments.0 + let sleeping = arguments.1 + cat.name = name + cat.sleeping = sleeping + } + } + container.register(Animal.self) { _ in Cat(name: "Mimi") } + let storyboard = SwinjectStoryboard.create(name: "Animals", bundle: bundle, container: container) + + // Instantiate the view controller, with an extra argument of a new name for the Cat, and a new sleeping param + let animalViewController = storyboard.instantiateViewController(withIdentifier: "AnimalAsCat", arguments: ("Whiskers", true)) as! AnimalViewController + // Assert that extra context was passed through correctly. + expect(animalViewController.hasAnimal(named: "Whiskers")) == true + guard let cat = animalViewController.animal as? Cat else { + fail() + return + } + expect(cat.sleeping)==true + } + it("should inject data passed into a view controller - 3 args") { + guard let container = container else { + fail() + return + } + + container.storyboardInitCompleted(AnimalViewController.self) { (r, c, arguments: (String, Bool, Food)) in + c.animal = r.resolve(Animal.self) + // Try to use the injected name argument to set a new name on the Cat + if let cat = c.animal as? Cat { + cat.name = arguments.0 + cat.sleeping = arguments.1 + cat.favoriteFood = arguments.2 + } + } + container.register(Animal.self) { _ in Cat(name: "Mimi") } + let storyboard = SwinjectStoryboard.create(name: "Animals", bundle: bundle, container: container) + + let arguments: (String, Bool, Food) = ("Whiskers", true, Sushi()) + // Instantiate the view controller, with an extra argument of a new name for the Cat. + let animalViewController = storyboard.instantiateViewController(withIdentifier: "AnimalAsCat", arguments: arguments) as! AnimalViewController + // Assert that the name was passed through correctly. + expect(animalViewController.hasAnimal(named: "Whiskers")) == true + guard let cat = animalViewController.animal as? Cat else { + fail() + return + } + expect(cat.sleeping)==true + expect(cat.favoriteFood is Sushi) == true + } + afterEach { + SwinjectStoryboard.defaultContainer.removeAll() + } + } describe("Setup") { it("calls setup function only once.") { _ = SwinjectStoryboard.create(name: "Animals", bundle: bundle) diff --git a/script/gencode b/script/gencode new file mode 100755 index 0000000..fdc6e0a --- /dev/null +++ b/script/gencode @@ -0,0 +1,8 @@ +#!/bin/sh + +files="Sources/SwinjectStoryboard.Arguments" + +for file in $files; do + echo "Generating code to $file.swift" + erb -v -T 1 $file.erb > $file.swift +done