diff --git a/Package.swift b/Package.swift index b259d6f..a3ebe7e 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.3 +// swift-tools-version:5.9 // 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 ac7d99d..71d9e19 100644 --- a/Sources/AlertToast/AlertToast.swift +++ b/Sources/AlertToast/AlertToast.swift @@ -442,6 +442,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