Skip to content

Commit 854fdb8

Browse files
Merge pull request #217 from Richard-Gist/buildCrash
Build crash fix
2 parents 56f8be0 + 6cc9b80 commit 854fdb8

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

ExampleApps/SwiftUIExample/SwiftUIExampleTests/UIKitInteropTests.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,15 @@ final class UIKitInteropTests: XCTestCase, View {
9999

100100
func testPuttingAUIKitViewThatDoesNotTakeInDataInsideASwiftUIWorkflow() async throws {
101101
final class FR1: UIWorkflowItem<Never, Never>, FlowRepresentable {
102-
let nextButton = UIButton()
102+
let nextButtonTag = UUID().hashValue
103103

104104
@objc private func nextPressed() {
105105
proceedInWorkflow()
106106
}
107107

108108
override func viewDidLoad() {
109+
let nextButton = UIButton()
110+
nextButton.tag = nextButtonTag
109111
nextButton.setTitle("Next", for: .normal)
110112
nextButton.setTitleColor(.systemBlue, for: .normal)
111113
nextButton.addTarget(self, action: #selector(nextPressed), for: .touchUpInside)
@@ -143,8 +145,9 @@ final class UIKitInteropTests: XCTestCase, View {
143145
proceedCalled.fulfill()
144146
}
145147

146-
XCTAssertEqual(vc.nextButton.willRespondToUser, true)
147-
vc.nextButton.simulateTouch()
148+
let nextButton = try XCTUnwrap(vc.view.viewWithTag(vc.nextButtonTag) as? UIButton)
149+
XCTAssertEqual(nextButton.willRespondToUser, true)
150+
nextButton.simulateTouch()
148151

149152
wait(for: [proceedCalled], timeout: TestConstant.timeout)
150153
}

0 commit comments

Comments
 (0)