Skip to content

Commit

Permalink
[feat] Add Swift 5.3 ifdef
Browse files Browse the repository at this point in the history
  • Loading branch information
mackoj committed Oct 19, 2020
1 parent fdae103 commit 6e08e9e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Sources/ComposableCoreLocation/Live.swift
Expand Up @@ -51,9 +51,11 @@ 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, *) {
return AccuracyAuthorization(dependencies[id]?.manager.accuracyAuthorization)
}
#endif
return nil
}

Expand Down
Expand Up @@ -2,10 +2,11 @@ import CoreLocation
import Foundation

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

#if swift(>=5.3)
@available(iOS 14, macCatalyst 14, macOS 11, tvOS 14, watchOS 7, *)
init?(_ accuracyAuth: CLAccuracyAuthorization?) {
switch accuracyAuth {
Expand All @@ -17,4 +18,5 @@ public enum AccuracyAuthorization {
return nil
}
}
#endif
}

0 comments on commit 6e08e9e

Please sign in to comment.