5 internal static class IOSHelpers
7 internal static UIWindow? GetWindow()
9 if (UIDevice.CurrentDevice.CheckSystemVersion(15, 0))
11 return UIApplication.SharedApplication.ConnectedScenes
12 .OfType<UIWindowScene>()
13 .SelectMany(s => s.Windows)
14 .FirstOrDefault(w => w.IsKeyWindow);
16 else if (UIDevice.CurrentDevice.CheckSystemVersion(14, 2))
17 return UIApplication.SharedApplication.Windows.FirstOrDefault(o => o.IsKeyWindow);
19 return UIApplication.SharedApplication.KeyWindow;
22 internal static ThemeStyle GetCurrentTheme()
24 return Application.Current?.RequestedTheme == AppTheme.Dark
25 ? ThemeStyle.Dark : ThemeStyle.Light;