From 7eeefc67210ec4465b71e4143b42f2bece0298c3 Mon Sep 17 00:00:00 2001 From: baegteun Date: Tue, 23 Apr 2024 23:34:41 +0900 Subject: [PATCH] =?UTF-8?q?:bug:=20::=20[#496]=20Swift=20expression=20?= =?UTF-8?q?=EB=AC=B8=EB=B2=95=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Projects/App/Sources/Application/AppDelegate.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Projects/App/Sources/Application/AppDelegate.swift b/Projects/App/Sources/Application/AppDelegate.swift index 88ea3a69c..f46f5afee 100644 --- a/Projects/App/Sources/Application/AppDelegate.swift +++ b/Projects/App/Sources/Application/AppDelegate.swift @@ -110,22 +110,24 @@ private extension AppDelegate { super.motionEnded(motion, with: event) switch motion { case .motionShake: - guard let topViewController = if #available(iOS 15.0, *) { - UIApplication.shared.connectedScenes + let topViewController: UIViewController? + if #available(iOS 15.0, *) { + topViewController = UIApplication.shared.connectedScenes .compactMap { $0 as? UIWindowScene } .filter { $0.activationState == .foregroundActive } .first? .keyWindow? .rootViewController } else { - UIApplication.shared.connectedScenes + topViewController = UIApplication.shared.connectedScenes .compactMap { $0 as? UIWindowScene } .filter { $0.activationState == .foregroundActive } .first? .windows .first(where: \.isKeyWindow)? .rootViewController - } else { break } + } + guard let topViewController else { break } if let nav = topViewController as? UINavigationController { nav.visibleViewController?.present(LogHistoryViewController(), animated: true) } else {