fix: iOS/iPadOS crashes on a start of the app because of there's no keyFrame set (#1448)

So setting one if it's not set.
This commit is contained in:
Yaroslav 2025-03-04 12:13:04 +01:00 committed by GitHub
parent 678bfffe49
commit d3339a7f3a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -14,10 +14,15 @@ extension UIApplication {
var keyWindows: [UIWindow] {
connectedScenes
.compactMap {
guard let windowScene = $0 as? UIWindowScene else { return nil }
if #available(iOS 15.0, *) {
($0 as? UIWindowScene)?.keyWindow
guard let keywindow = windowScene.keyWindow else {
windowScene.windows.first?.makeKey()
return windowScene.windows.first
}
return keywindow
} else {
($0 as? UIWindowScene)?.windows.first { $0.isKeyWindow }
return windowScene.windows.first { $0.isKeyWindow }
}
}
}