diff --git a/Sources/SwiftLocation/Async Tasks/BeaconMonitoring.swift b/Sources/SwiftLocation/Async Tasks/BeaconMonitoring.swift index 43f2a78..22472dc 100644 --- a/Sources/SwiftLocation/Async Tasks/BeaconMonitoring.swift +++ b/Sources/SwiftLocation/Async Tasks/BeaconMonitoring.swift @@ -26,7 +26,7 @@ import Foundation import CoreLocation -#if !os(watchOS) && !os(tvOS) +#if !os(watchOS) && !os(tvOS) && !os(visionOS) extension Tasks { public final class BeaconMonitoring: AnyTask { diff --git a/Sources/SwiftLocation/Async Tasks/LocatePermission.swift b/Sources/SwiftLocation/Async Tasks/LocatePermission.swift index dcd0657..7362cf2 100644 --- a/Sources/SwiftLocation/Async Tasks/LocatePermission.swift +++ b/Sources/SwiftLocation/Async Tasks/LocatePermission.swift @@ -84,7 +84,7 @@ extension Tasks { } } - #if !os(tvOS) + #if !os(tvOS) && !os(visionOS) func requestAlwaysPermission() async throws -> CLAuthorizationStatus { try await withCheckedThrowingContinuation { continuation in guard let instance = self.instance else { return } diff --git a/Sources/SwiftLocation/Async Tasks/RegionMonitoring.swift b/Sources/SwiftLocation/Async Tasks/RegionMonitoring.swift index 2a32806..627cf02 100644 --- a/Sources/SwiftLocation/Async Tasks/RegionMonitoring.swift +++ b/Sources/SwiftLocation/Async Tasks/RegionMonitoring.swift @@ -26,6 +26,8 @@ import Foundation import CoreLocation +#if !os(visionOS) + extension Tasks { public final class RegionMonitoring: AnyTask { @@ -121,3 +123,5 @@ extension Tasks { } } + +#endif diff --git a/Sources/SwiftLocation/Async Tasks/VisitsMonitoring.swift b/Sources/SwiftLocation/Async Tasks/VisitsMonitoring.swift index a65ac45..d32366a 100644 --- a/Sources/SwiftLocation/Async Tasks/VisitsMonitoring.swift +++ b/Sources/SwiftLocation/Async Tasks/VisitsMonitoring.swift @@ -26,7 +26,7 @@ import Foundation import CoreLocation -#if !os(watchOS) && !os(tvOS) +#if !os(watchOS) && !os(tvOS) && !os(visionOS) extension Tasks { public final class VisitsMonitoring: AnyTask { diff --git a/Sources/SwiftLocation/Location Managers/LocationManagerBridgeEvent.swift b/Sources/SwiftLocation/Location Managers/LocationManagerBridgeEvent.swift index dd4d968..8fb3bfc 100644 --- a/Sources/SwiftLocation/Location Managers/LocationManagerBridgeEvent.swift +++ b/Sources/SwiftLocation/Location Managers/LocationManagerBridgeEvent.swift @@ -43,18 +43,23 @@ public enum LocationManagerBridgeEvent { // MARK: - Region Monitoring + #if !os(visionOS) case didEnterRegion(_ region: CLRegion) case didExitRegion(_ region: CLRegion) case didStartMonitoringFor(_ region: CLRegion) - + #endif + // MARK: - Failures case didFailWithError(_ error: Error) + + #if !os(visionOS) case monitoringDidFailFor(region: CLRegion?, error: Error) - + #endif + // MARK: - Visits Monitoring - #if !os(watchOS) && !os(tvOS) + #if !os(watchOS) && !os(tvOS) && !os(visionOS) case didVisit(visit: CLVisit) #endif @@ -66,7 +71,7 @@ public enum LocationManagerBridgeEvent { // MARK: - Beacons - #if !os(watchOS) && !os(tvOS) + #if !os(watchOS) && !os(tvOS) && !os(visionOS) case didRange(beacons: [CLBeacon], constraint: CLBeaconIdentityConstraint) case didFailRanginFor(constraint: CLBeaconIdentityConstraint, error: Error) #endif diff --git a/Sources/SwiftLocation/Location Managers/LocationManagerProtocol.swift b/Sources/SwiftLocation/Location Managers/LocationManagerProtocol.swift index 450cc53..8174799 100644 --- a/Sources/SwiftLocation/Location Managers/LocationManagerProtocol.swift +++ b/Sources/SwiftLocation/Location Managers/LocationManagerProtocol.swift @@ -46,7 +46,7 @@ public protocol LocationManagerProtocol { var distanceFilter: CLLocationDistance { get set } var desiredAccuracy: CLLocationAccuracy { get set } - #if !os(tvOS) + #if !os(tvOS) && !os(visionOS) var allowsBackgroundLocationUpdates: Bool { get set } #endif @@ -58,7 +58,7 @@ public protocol LocationManagerProtocol { func validatePlistConfigurationForTemporaryAccuracy(purposeKey: String) throws func requestWhenInUseAuthorization() - #if !os(tvOS) + #if !os(tvOS) && !os(visionOS) func requestAlwaysAuthorization() #endif func requestTemporaryFullAccuracyAuthorization(withPurposeKey purposeKey: String, completion: ((Error?) -> Void)?) @@ -71,7 +71,7 @@ public protocol LocationManagerProtocol { #endif func requestLocation() - #if !os(watchOS) && !os(tvOS) + #if !os(watchOS) && !os(tvOS) && !os(visionOS) // MARK: - Monitoring Regions func startMonitoring(for region: CLRegion) @@ -80,12 +80,12 @@ public protocol LocationManagerProtocol { // MARK: - Monitoring Visits - #if !os(watchOS) && !os(tvOS) + #if !os(watchOS) && !os(tvOS) && !os(visionOS) func startMonitoringVisits() func stopMonitoringVisits() #endif - #if !os(watchOS) && !os(tvOS) + #if !os(watchOS) && !os(tvOS) && !os(visionOS) // MARK: - Monitoring Significant Location Changes func startMonitoringSignificantLocationChanges() @@ -101,7 +101,7 @@ public protocol LocationManagerProtocol { // MARK: - Beacon Ranging - #if !os(watchOS) && !os(tvOS) + #if !os(watchOS) && !os(tvOS) && !os(visionOS) func startRangingBeacons(satisfying constraint: CLBeaconIdentityConstraint) func stopRangingBeacons(satisfying constraint: CLBeaconIdentityConstraint) #endif diff --git a/Sources/SwiftLocation/Location.swift b/Sources/SwiftLocation/Location.swift index f722b41..d507c2b 100644 --- a/Sources/SwiftLocation/Location.swift +++ b/Sources/SwiftLocation/Location.swift @@ -117,7 +117,7 @@ public final class Location { /// Core Location configures the system to keep the app running to receive continuous background location updates, /// and arranges to show the background location indicator (blue bar or pill) if needed. /// Updates continue even if the app subsequently enters the background. - #if !os(tvOS) + #if !os(tvOS) && !os(visionOS) public var allowsBackgroundLocationUpdates: Bool { get { locationManager.allowsBackgroundLocationUpdates } set { locationManager.allowsBackgroundLocationUpdates = newValue } @@ -126,7 +126,7 @@ public final class Location { // MARK: - Initialization - #if !os(tvOS) + #if !os(tvOS) && !os(visionOS) /// Initialize a new SwiftLocation instance to work with the Core Location service. /// /// - Parameter locationManager: underlying service. By default the device's CLLocationManager instance is used @@ -229,7 +229,7 @@ public final class Location { switch permission { case .whenInUse: return try await requestWhenInUsePermission() - #if !os(tvOS) + #if !os(tvOS) && !os(visionOS) case .always: #if APPCLIP return try await requestWhenInUsePermission() @@ -252,7 +252,7 @@ public final class Location { // MARK: - Monitor Location Updates - #if !os(tvOS) + #if !os(tvOS) && !os(visionOS) /// Start receiving changes of the locations with a stream. /// /// - Returns: events received from the location manager. @@ -305,7 +305,7 @@ public final class Location { } } - #if !os(watchOS) && !os(tvOS) + #if !os(watchOS) && !os(tvOS) && !os(visionOS) // MARK: - Monitor Regions /// Starts the monitoring a region and receive stream of events from it. @@ -336,7 +336,7 @@ public final class Location { // MARK: - Monitor Visits Updates - #if !os(watchOS) && !os(tvOS) + #if !os(watchOS) && !os(tvOS) && !os(visionOS) /// Starts monitoring visits to locations. /// /// - Returns: stream of events for visits. @@ -359,7 +359,7 @@ public final class Location { } #endif - #if !os(watchOS) && !os(tvOS) + #if !os(watchOS) && !os(tvOS) && !os(visionOS) // MARK: - Monitor Significant Locations /// Starts monitoring significant location changes. @@ -415,7 +415,7 @@ public final class Location { /// /// - Parameter satisfying: A `CLBeaconIdentityConstraint` constraint. /// - Returns: stream of events related to passed constraint. - #if !os(watchOS) && !os(tvOS) + #if !os(watchOS) && !os(tvOS) && !os(visionOS) public func startRangingBeacons(satisfying: CLBeaconIdentityConstraint) async -> Tasks.BeaconMonitoring.Stream { let task = Tasks.BeaconMonitoring(satisfying: satisfying) return Tasks.BeaconMonitoring.Stream { stream in @@ -466,7 +466,7 @@ public final class Location { } } - #if !os(tvOS) + #if !os(tvOS) && !os(visionOS) /// Request authorization to get location both in foreground and background. /// /// - Returns: authorization obtained. diff --git a/Sources/SwiftLocation/Support/Extensions.swift b/Sources/SwiftLocation/Support/Extensions.swift index 692c23d..54a44a8 100644 --- a/Sources/SwiftLocation/Support/Extensions.swift +++ b/Sources/SwiftLocation/Support/Extensions.swift @@ -39,7 +39,7 @@ extension CLLocationManager: LocationManagerProtocol { /// - Parameter permission: permission you would to obtain. public func validatePlistConfigurationOrThrow(permission: LocationPermission) throws { switch permission { - #if !os(tvOS) + #if !os(tvOS) && !os(visionOS) case .always: if !Bundle.hasAlwaysAndWhenInUsePermission() { throw LocationErrors.plistNotConfigured diff --git a/Sources/SwiftLocation/Support/SupportModels.swift b/Sources/SwiftLocation/Support/SupportModels.swift index e6a2b72..4cb7db9 100644 --- a/Sources/SwiftLocation/Support/SupportModels.swift +++ b/Sources/SwiftLocation/Support/SupportModels.swift @@ -167,7 +167,7 @@ public enum LocationAccuracy { public enum LocationPermission { /// Always authorization, both background and when in use. - #if !os(tvOS) + #if !os(tvOS) && !os(visionOS) case always #endif /// Only when in use authorization.