Skip to content

Commit

Permalink
Merge pull request #5 from andreyz/accuracy-authorization
Browse files Browse the repository at this point in the history
AccuracyAuthorization with macOS and macCatalyst compilation
  • Loading branch information
mackoj committed Oct 23, 2020
2 parents 6e08e9e + 7bed5b7 commit 1b8cc06
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Sources/ComposableCoreLocation/Live.swift
Expand Up @@ -51,8 +51,8 @@ extension LocationManager {
manager.location = { id in dependencies[id]?.manager.location.map(Location.init(rawValue:)) }

manager.accuracyAuthorization = { id in
#if swift(>=5.3)
if #available(iOS 14, tvOS 14, watchOS 7, macOS 11, macCatalyst 14, *) {
#if (compiler(>=5.3) && !(os(macOS) || targetEnvironment(macCatalyst))) || compiler(>=5.3.1)
if #available(iOS 14.0, tvOS 14.0, watchOS 7.0, macOS 11.0, macCatalyst 14.0, *) {
return AccuracyAuthorization(dependencies[id]?.manager.accuracyAuthorization)
}
#endif
Expand Down
@@ -1,13 +1,15 @@
import CoreLocation
import Foundation

/// A value type wrapper for `CLAccuracyAuthorization`. This type is necessary to have iOS 13 support
public enum AccuracyAuthorization: Hashable {
case fullAccuracy
case reducedAccuracy
/// A value type wrapper for `CLAccuracyAuthorization`
public enum AccuracyAuthorization: Int {
case fullAccuracy = 0
case reducedAccuracy = 1
}

#if swift(>=5.3)
@available(iOS 14, macCatalyst 14, macOS 11, tvOS 14, watchOS 7, *)
#if (compiler(>=5.3) && !(os(macOS) || targetEnvironment(macCatalyst))) || compiler(>=5.3.1)
@available(iOS 14.0, macCatalyst 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
extension AccuracyAuthorization {
init?(_ accuracyAuth: CLAccuracyAuthorization?) {
switch accuracyAuth {
case .fullAccuracy:
Expand All @@ -18,5 +20,5 @@ public enum AccuracyAuthorization: Hashable {
return nil
}
}
#endif
}
#endif

0 comments on commit 1b8cc06

Please sign in to comment.