From 24dae4e6fd4f1cc85ae435be2d5df77f02f11547 Mon Sep 17 00:00:00 2001 From: Huanyu Luo Date: Sun, 28 Jan 2024 21:14:07 +0800 Subject: [PATCH] Add visionOS support. --- Sources/AlertToast/AlertToast.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sources/AlertToast/AlertToast.swift b/Sources/AlertToast/AlertToast.swift index 5d755e4..ff4287e 100644 --- a/Sources/AlertToast/AlertToast.swift +++ b/Sources/AlertToast/AlertToast.swift @@ -428,6 +428,11 @@ public struct AlertToastModifier: ViewModifier{ private var screen: CGRect { #if os(iOS) return UIScreen.main.bounds +#elseif os(visionOS) + if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene { + return windowScene.coordinateSpace.bounds + } + return .zero #else return NSScreen.main?.frame ?? .zero #endif