Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated iOS framework to Swift 4.2 #110

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Sources/SwinjectStoryboard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,15 @@ public class SwinjectStoryboard: _SwinjectStoryboardBase, SwinjectStoryboardProt
fatalError("A type conforming Resolver protocol must conform _Resolver protocol too.")
}

for child in viewController.childViewControllers {
injectDependency(to: child)
}
#if swift(>=4.2)
for child in viewController.children {
injectDependency(to: child)
}
#else
for child in viewController.childViewControllers {
injectDependency(to: child)
}
#endif
}

#elseif os(OSX)
Expand Down
11 changes: 9 additions & 2 deletions Tests/iOS-tvOS/SwinjectStoryboardSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,15 @@ class SwinjectStoryboardSpec: QuickSpec {

let storyboard = SwinjectStoryboard.create(name: "Tabs", bundle: bundle, container: container)
let tabBarController = storyboard.instantiateViewController(withIdentifier: "TabBarController")
let animalViewController1 = tabBarController.childViewControllers[0] as! AnimalViewController
let animalViewController2 = tabBarController.childViewControllers[1] as! AnimalViewController

#if swift(>=4.2)
let animalViewController1 = tabBarController.children[0] as! AnimalViewController
let animalViewController2 = tabBarController.children[1] as! AnimalViewController
#else
let animalViewController1 = tabBarController.childViewControllers[0] as! AnimalViewController
let animalViewController2 = tabBarController.childViewControllers[1] as! AnimalViewController
#endif

let cat1 = animalViewController1.animal as! Cat
let cat2 = animalViewController2.animal as! Cat
expect(cat1 === cat2).to(beTrue()) // Workaround for crash in Nimble.
Expand Down