diff --git a/WooCommerce/Classes/Environment Keys/SafeAreaInsetsKey.swift b/WooCommerce/Classes/Environment Keys/SafeAreaInsetsKey.swift index d20c80ac898..48b91da3b56 100644 --- a/WooCommerce/Classes/Environment Keys/SafeAreaInsetsKey.swift +++ b/WooCommerce/Classes/Environment Keys/SafeAreaInsetsKey.swift @@ -8,7 +8,10 @@ struct SafeAreaInsetsKey: EnvironmentKey { /// Returns the safe areas of the main window. /// static var defaultValue: EdgeInsets { - guard let window = UIApplication.shared.windows.first else { + + // Get the first window from all connected scenes + let scenes = UIApplication.shared.connectedScenes + guard let window = scenes.compactMap({ $0 as? UIWindowScene }).flatMap({ $0.windows }).first else { return .zero }