From b5203b20016c4ee22248cc45974b70d62e1d0502 Mon Sep 17 00:00:00 2001 From: noppe Date: Tue, 4 Jan 2022 16:50:13 +0900 Subject: [PATCH] without makeKeyAndVisible --- .../DebugMenu/Extensions/UIApplication+.swift | 21 ------------------- .../DebugMenu/View/InAppDebuggerWindow.swift | 5 +---- 2 files changed, 1 insertion(+), 25 deletions(-) delete mode 100644 Sources/DebugMenu/Extensions/UIApplication+.swift diff --git a/Sources/DebugMenu/Extensions/UIApplication+.swift b/Sources/DebugMenu/Extensions/UIApplication+.swift deleted file mode 100644 index 0621a50..0000000 --- a/Sources/DebugMenu/Extensions/UIApplication+.swift +++ /dev/null @@ -1,21 +0,0 @@ -// -// UIApplication+.swift -// DebugMenu -// -// Created by Tomoya Hirano on 2020/12/23. -// - -import UIKit - -@available(iOSApplicationExtension, unavailable) -extension UIApplication { - func findKeyWindow() -> UIWindow? { - (connectedScenes - .filter({ $0.activationState == .foregroundActive }) - .compactMap({ $0 as? UIWindowScene }) - .first? - .windows ?? windows) - .filter({ !($0 is InAppDebuggerWindow) }) - .filter({ $0.isKeyWindow }).first - } -} diff --git a/Sources/DebugMenu/View/InAppDebuggerWindow.swift b/Sources/DebugMenu/View/InAppDebuggerWindow.swift index a953b28..1f3ca39 100644 --- a/Sources/DebugMenu/View/InAppDebuggerWindow.swift +++ b/Sources/DebugMenu/View/InAppDebuggerWindow.swift @@ -45,7 +45,6 @@ public class InAppDebuggerWindow: UIWindow { dashboardItems: [DashboardItem], options: [Options] ) { - let keyWindow = UIApplication.shared.findKeyWindow() let window = factory() window.windowLevel = UIWindow.Level.statusBar + 1 window.rootViewController = FloatingViewController( @@ -55,10 +54,8 @@ public class InAppDebuggerWindow: UIWindow { ) // visible時にディスプレイサイズと同じサイズだとスクリーンエッジの設定を決める対象に選ばれるので避ける window.frame.size.width += 1 - window.makeKeyAndVisible() + window.isHidden = false window.frame.size.width -= 1 - - keyWindow?.makeKeyAndVisible() windows.append(window) }