Skip to content

Commit 7e9e0d5

Browse files
authored
Merge pull request #8077 from woocommerce/task/window-deprecated-ios-15
windows was deprecated in iOS 15: Use UIWindowScene.windows instead
2 parents cd381c4 + 3c50ecf commit 7e9e0d5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

WooCommerce/Classes/Environment Keys/SafeAreaInsetsKey.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ struct SafeAreaInsetsKey: EnvironmentKey {
88
/// Returns the safe areas of the main window.
99
///
1010
static var defaultValue: EdgeInsets {
11-
guard let window = UIApplication.shared.windows.first else {
11+
12+
// Get the first window from all connected scenes
13+
let scenes = UIApplication.shared.connectedScenes
14+
guard let window = scenes.compactMap({ $0 as? UIWindowScene }).flatMap({ $0.windows }).first else {
1215
return .zero
1316
}
1417

0 commit comments

Comments
 (0)