Skip to content

Commit

Permalink
Merge pull request #19 from trafi/improve-implicit-destination
Browse files Browse the repository at this point in the history
Improve implicit destination
  • Loading branch information
mikasdo authored Aug 10, 2023
2 parents cee795c + 3837c5e commit f1f3fbd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
15 changes: 2 additions & 13 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,5 @@ jobs:
- name: Run StoryFlow tests
run: |
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
xcodebuild test -scheme StoryFlow -destination "platform=iOS Simulator,name=iPhone 13" | xcpretty
- uses: codecov/codecov-action@v1
12 changes: 10 additions & 2 deletions Sources/StoryFlow/Flow/ImplicitFlow/ImplicitFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,16 @@ extension Flow {

private static func destination(for output: ValueAndType) -> UIViewController? {
let (value, type) = OutputTransform.apply(output)

for inType in inputRequiringTypes where oneOf(inType._inputType, contains: type) {

let candidates = inputRequiringTypes.filter { oneOf($0._inputType, contains: type) }
let supers = candidates.compactMap { class_getSuperclass($0 as? AnyClass) }

let remainingCandidates = candidates.filter { c in
let isSuper = supers.contains { s in s == (c as? AnyClass) }
return !isSuper
}

for inType in remainingCandidates {
return inType._create(input: value)
}

Expand Down

0 comments on commit f1f3fbd

Please sign in to comment.