diff --git a/Package.swift b/Package.swift index b259d6f..9ccdc8b 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.3 +// swift-tools-version:5.10 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -7,7 +7,8 @@ let package = Package( name: "AlertToast", platforms: [ .iOS(.v14), - .macOS(.v11) + .macOS(.v11), + .visionOS(.v1) ], products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. diff --git a/Sources/AlertToast/AlertToast.swift b/Sources/AlertToast/AlertToast.swift index 17bf751..dd482c7 100644 --- a/Sources/AlertToast/AlertToast.swift +++ b/Sources/AlertToast/AlertToast.swift @@ -436,6 +436,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