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

Fixes StoryboardLoadable protocol not working with AnyWorkflow.PassedArgs #81

Merged
merged 16 commits into from
Jul 27, 2021
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
a2ee0c0
[skip ci] passedargs-fix - This passes locally and seems to fix the i…
Richard-Gist Jul 26, 2021
bafafba
[passedargs-fix] - TDD the potential solution and added partial ToS t…
Richard-Gist Jul 26, 2021
a631069
[passedargs-fix] - Fixed in StoryboardLoadable when receiving args - …
Richard-Gist Jul 26, 2021
f63149f
[skip ci] passedargs-fix - Test for one of the warnings - TT RAG
Richard-Gist Jul 26, 2021
086501b
[passedargs-fix] - Added inherited no input view controller so that w…
Tyler-Keith-Thompson Jul 26, 2021
b4bbf66
[passedargs-fix] - Problem is solved, things do work but we still nee…
Tyler-Keith-Thompson Jul 26, 2021
0629632
Merge branch 'main' into passedargs-fix
Richard-Gist Jul 26, 2021
11485ca
[passedargs-fix] - Fixed an old typo - TT
Tyler-Keith-Thompson Jul 26, 2021
0afec02
Merge branch 'passedargs-fix' of github.com:wwt/SwiftCurrent into pas…
Tyler-Keith-Thompson Jul 26, 2021
af9a3f8
[passedargs-fix] - Added abandon test in and gave Richard credit on t…
Tyler-Keith-Thompson Jul 26, 2021
1177c19
[passedargs-fix] - Updated readme with a new area of interest - TT
Tyler-Keith-Thompson Jul 26, 2021
7129796
Merge branch 'main' into passedargs-fix
morganzellers Jul 27, 2021
3f7ad1b
Merge branch 'main' into passedargs-fix
Tyler-Keith-Thompson Jul 27, 2021
832dc32
Merge branch 'main' into passedargs-fix
Tyler-Keith-Thompson Jul 27, 2021
ef0b5df
[passedargs-fix] - Updating test to pass for everyone not just tyler …
Richard-Gist Jul 27, 2021
cdec6d6
[passedargs-fix] - Adding coverage to PassthroughFlowRepresentable fa…
Richard-Gist Jul 27, 2021
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
4 changes: 4 additions & 0 deletions ExampleApps/UIKitExample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,9 @@ This screen launches an interim `Workflow` when selecting Delivery.
### LocationsViewController
This screen uses conditional loading logic in its `shouldLoad` method, and it has distinct input and output types.

### TermsOfServiceViewController
This screen is a special type of `FlowRepresentable` called a `PassthroughFlowRepresentable`. It does not have to store arguments itself, instead they are passed automatically to the next item.
This screen also abandons the entire workflow if the terms are rejected, preventing any future screens from being shown.

### StoryboardLoadable
This file configures SwiftCurrent to load our views from Storyboards.
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ class StoryboardLoadableTests: XCTestCase {
}
}

XCTAssertThrowsFatalError {
XCTAssertThrowsError(try ExceptionCatcher.catch {
_ = TestInputViewController._factory(Test.self, with: "some")
}
})
}

func testStoryboardLoadable_WithInputOfNever_ThrowsErrorWhenItIsOfADifferentTypeOnStoryboard() throws {
Expand Down Expand Up @@ -87,13 +87,21 @@ class StoryboardLoadableTests: XCTestCase {
AnyFlowRepresentable(TestNoInputViewController.self, args: .none)
})

XCTAssertNoThrow(try ExceptionCatcher.catch {
AnyFlowRepresentable(InheritedNoInputViewController.self, args: .none)
})

XCTAssertNoThrow(try ExceptionCatcher.catch {
AnyFlowRepresentable(TestInputViewController.self, args: .args("some"))
})

XCTAssertNoThrow(try ExceptionCatcher.catch {
AnyFlowRepresentable(PassthroughViewController.self, args: .args("some"))
})

XCTAssertNoThrow(try ExceptionCatcher.catch {
AnyFlowRepresentable(InheritedPassthroughViewController.self, args: .args("some"))
})
}
}

Expand Down Expand Up @@ -132,3 +140,6 @@ class PassthroughViewController: UIViewController, StoryboardLoadable, Passthrou
UIStoryboard(name: "TestStoryboard", bundle: Bundle(for: Self.self))
}
}

class InheritedPassthroughViewController: PassthroughViewController {}
class InheritedNoInputViewController: TestNoInputViewController {}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,36 @@
</objects>
<point key="canvasLocation" x="1451" y="134"/>
</scene>
<!--Inherited Passthrough View Controller-->
<scene sceneID="jWR-9k-Ery">
<objects>
<viewController storyboardIdentifier="InheritedPassthroughViewController" id="zCo-Ho-fND" customClass="InheritedPassthroughViewController" customModule="SwiftCurrent_UIKitTests" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="aUK-Do-g3i">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<viewLayoutGuide key="safeArea" id="EyL-Eu-EHQ"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="nwU-64-iQj" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2109" y="134"/>
</scene>
<!--Inherited No Input View Controller-->
<scene sceneID="BgZ-0s-lKw">
<objects>
<viewController storyboardIdentifier="InheritedNoInputViewController" id="Tzy-Yf-SqW" customClass="InheritedNoInputViewController" customModule="SwiftCurrent_UIKitTests" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="vXS-V4-raH">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<viewLayoutGuide key="safeArea" id="ULe-uM-pSR"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Wpk-cR-kNb" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2757" y="134"/>
</scene>
</scenes>
<resources>
<systemColor name="systemBackgroundColor">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
CAF58743256CF55E0044C864 /* UIUTest in Frameworks */ = {isa = PBXBuildFile; productRef = CAF58742256CF55E0044C864 /* UIUTest */; };
D7226A5C267820070066E9E6 /* SwiftCurrent in Frameworks */ = {isa = PBXBuildFile; productRef = D7226A5B267820070066E9E6 /* SwiftCurrent */; };
D7226A602678238F0066E9E6 /* SwiftCurrent_UIKit in Frameworks */ = {isa = PBXBuildFile; productRef = D7226A5F2678238F0066E9E6 /* SwiftCurrent_UIKit */; };
D73767A926AF5D2D000A6A6E /* TermsOfServiceViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D73767A826AF5D2D000A6A6E /* TermsOfServiceViewControllerTests.swift */; };
D73767AB26AF625F000A6A6E /* TermsOfServiceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D73767AA26AF625F000A6A6E /* TermsOfServiceViewController.swift */; };
D7E1264E264C6FBD00B6A712 /* UIKitConsumerAbandonTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7E1264D264C6FBD00B6A712 /* UIKitConsumerAbandonTests.swift */; };
D7E12656264C719B00B6A712 /* UIKitConsumerSkipTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7E12655264C719B00B6A712 /* UIKitConsumerSkipTests.swift */; };
D7E1265E264C73BA00B6A712 /* UIKitConsumerLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7E1265D264C73BA00B6A712 /* UIKitConsumerLaunchTests.swift */; };
Expand Down Expand Up @@ -128,6 +130,8 @@
CAF586AE256CF2B40044C864 /* UIKitExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UIKitExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
CAF5871F256CF4DC0044C864 /* UIUTest_ObjC.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = UIUTest_ObjC.framework; sourceTree = BUILT_PRODUCTS_DIR; };
CAF58721256CF4DC0044C864 /* UIUTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = UIUTest.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D73767A826AF5D2D000A6A6E /* TermsOfServiceViewControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TermsOfServiceViewControllerTests.swift; sourceTree = "<group>"; };
D73767AA26AF625F000A6A6E /* TermsOfServiceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TermsOfServiceViewController.swift; sourceTree = "<group>"; };
D74A4D5A26A6115200010617 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
D7E1264D264C6FBD00B6A712 /* UIKitConsumerAbandonTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIKitConsumerAbandonTests.swift; sourceTree = "<group>"; };
D7E12655264C719B00B6A712 /* UIKitConsumerSkipTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIKitConsumerSkipTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -185,6 +189,7 @@
CA0536E326A0848B00BF8FC5 /* TestFinder.swift */,
CA0536DD26A0848B00BF8FC5 /* ViewControllerTest.swift */,
CA0536B026A0834B00BF8FC5 /* Info.plist */,
D73767A826AF5D2D000A6A6E /* TermsOfServiceViewControllerTests.swift */,
);
path = UIKitExampleTests;
sourceTree = "<group>";
Expand All @@ -201,6 +206,7 @@
CA0536C326A0834B00BF8FC5 /* AppDelegate.swift */,
CA0536C426A0834B00BF8FC5 /* Protocols */,
CA0536C626A0834B00BF8FC5 /* Info.plist */,
D73767AA26AF625F000A6A6E /* TermsOfServiceViewController.swift */,
CA0536C726A0834B00BF8FC5 /* SceneDelegate.swift */,
);
path = UIKitExample;
Expand Down Expand Up @@ -484,6 +490,7 @@
CA0536D926A0834B00BF8FC5 /* SceneDelegate.swift in Sources */,
CA0536CF26A0834B00BF8FC5 /* LocationsViewController.swift in Sources */,
CA0536D226A0834B00BF8FC5 /* EnterAddressViewController.swift in Sources */,
D73767AB26AF625F000A6A6E /* TermsOfServiceViewController.swift in Sources */,
CA0536D026A0834B00BF8FC5 /* FoodSelectionViewController.swift in Sources */,
CA0536D326A0834B00BF8FC5 /* ReviewOrderViewController.swift in Sources */,
);
Expand Down Expand Up @@ -518,6 +525,7 @@
CA0536E926A0848B00BF8FC5 /* ReviewOrderViewControllerTests.swift in Sources */,
CA0536EE26A0848B00BF8FC5 /* FoodSelectionViewControllerTests.swift in Sources */,
CA0536E826A0848B00BF8FC5 /* SetupViewControllerTests.swift in Sources */,
D73767A926AF5D2D000A6A6E /* TermsOfServiceViewControllerTests.swift in Sources */,
CA0536EA26A0848B00BF8FC5 /* ViewControllerTest.swift in Sources */,
CA0536EC26A0848B00BF8FC5 /* LocationsViewControllerTests.swift in Sources */,
CA0536F026A0848B00BF8FC5 /* TestFinder.swift in Sources */,
Expand Down
Loading