From 6d4d9eecdee4605ee5e6e3ad8b6938808c8dfddc Mon Sep 17 00:00:00 2001 From: Gabriel Lanata Date: Sat, 21 Sep 2024 15:19:52 -0700 Subject: [PATCH] Fix --- Sources/Hammer/Utilties/HammerWindow.swift | 1 - Tests/HammerTests/KeyboardTests.swift | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/Hammer/Utilties/HammerWindow.swift b/Sources/Hammer/Utilties/HammerWindow.swift index b3404dc..62c1266 100644 --- a/Sources/Hammer/Utilties/HammerWindow.swift +++ b/Sources/Hammer/Utilties/HammerWindow.swift @@ -120,7 +120,6 @@ extension UIWindow { } } - @available(iOS 13.0, *) private extension UIScene { static var mainOrFirstConnectedScene: UIWindowScene? { diff --git a/Tests/HammerTests/KeyboardTests.swift b/Tests/HammerTests/KeyboardTests.swift index 19f62f7..3fd23de 100644 --- a/Tests/HammerTests/KeyboardTests.swift +++ b/Tests/HammerTests/KeyboardTests.swift @@ -187,8 +187,11 @@ final class KeyboardTests: XCTestCase { view.centerXAnchor.constraint(equalTo: viewController.view.centerXAnchor), ]) - let window = UIWindow(wrapping: viewController) + let window = UIWindow(frame: UIScreen.main.bounds) + window.rootViewController = viewController + window.addToMainSceneIfNeeded() window.isHidden = false + defer { window.removeFromScene() } let eventGenerator = try EventGenerator(window: window) try eventGenerator.waitUntilHittable(timeout: 1)