Skip to content

Commit

Permalink
fix(splash-screen): pick first window when there is no key window (#730)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Dec 7, 2021
1 parent 6dde082 commit 0e335ad
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion splash-screen/ios/Plugin/SplashScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ import Capacitor
var window: UIWindow? = UIApplication.shared.delegate?.window as? UIWindow

if #available(iOS 13, *), window == nil {
window = (UIApplication.shared.connectedScenes.first as? UIWindowScene)?.windows.filter({$0.isKeyWindow}).first
let scene: UIWindowScene? = UIApplication.shared.connectedScenes.first as? UIWindowScene
window = scene?.windows.filter({$0.isKeyWindow}).first
if window == nil {
window = scene?.windows.first
}
}

if let unwrappedWindow = window {
Expand Down

0 comments on commit 0e335ad

Please sign in to comment.