Skip to content

Commit

Permalink
Merge pull request #14 from trafi/fix/ios12
Browse files Browse the repository at this point in the history
Add tests for iOS 12
  • Loading branch information
Domas Nutautas committed Jun 4, 2020
2 parents 745d7db + 0ed9a68 commit 46daeb2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,14 @@ jobs:
set -eo pipefail
xcodebuild test -scheme StoryFlow -destination "platform=iOS Simulator,name=iPhone 11" | xcpretty
- uses: codecov/codecov-action@v1
test-iOS-12:
runs-on: macOS-latest
env:
DEVELOPER_DIR: /Applications/Xcode_10.3.app/Contents/Developer
steps:
- uses: actions/checkout@v1
- name: Run StoryFlow tests on iOS 12
run: |
set -eo pipefail
xcodebuild test -scheme StoryFlow -destination "platform=iOS Simulator,OS=12.4,name=iPhone 8" | xcpretty
5 changes: 3 additions & 2 deletions Sources/StoryFlow/Flow/Helpers/Transition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,13 @@ extension Transition where To == UIViewController {
private extension UIViewController {

var parentInTabBarController: UIViewController? {
self.parent == self.tabBarController ? self : self.parent?.parentInTabBarController
return self.parent == self.tabBarController ? self : self.parent?.parentInTabBarController
}

func afterDismissingCompleted(_ transition: @escaping () -> ()) {
if presentedViewController?.isBeingDismissed == true {
presentedViewController?.dismiss(animated: true, completion: transition)
presentedViewController?.transitionCoordinator?
.animate(alongsideTransition: nil, completion: { _ in transition() })
} else {
transition()
}
Expand Down
10 changes: 5 additions & 5 deletions Sources/StoryFlow/Flow/Helpers/Unwinding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import UIKit
extension UIViewController {

func unwindVc(for updateType: Any.Type) -> UIViewController? {
unwindVc(for: updateType, from: self)
return unwindVc(for: updateType, from: self)
}

private func unwindVc(for updateType: Any.Type, from source: UIViewController) -> UIViewController? {

Thread.onMain {
return Thread.onMain {
if canHandle(updateType, from: source) {
return self
} else if let vc = navStacks.first(where: { $0.canHandle(updateType, from: source) }) {
Expand Down Expand Up @@ -48,15 +48,15 @@ private extension UIViewController {
}

func allChild<T>(_ t: T.Type) -> [T] {
[self as? T].compactMap { $0 } + children.flatMap { $0.allChild(t) }
return [self as? T].compactMap { $0 } + children.flatMap { $0.allChild(t) }
}

var navStacks: [UIViewController] {
allChild(UINavigationController.self).flatMap { $0.viewControllers.reversed() }
return allChild(UINavigationController.self).flatMap { $0.viewControllers.reversed() }
}

var tabs: [UIViewController] {
allChild(UITabBarController.self).flatMap { $0.viewControllers ?? [] }
return allChild(UITabBarController.self).flatMap { $0.viewControllers ?? [] }
}

func isVc(for updateType: Any.Type) -> Bool {
Expand Down

0 comments on commit 46daeb2

Please sign in to comment.