chore: wire in location services
Signed-off-by: Alan Brault <alan.brault@visus.io>
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import Foundation
|
||||
|
||||
public struct Coordinate: Sendable, Hashable, Codable {
|
||||
public let latitude: Double
|
||||
public let longitude: Double
|
||||
|
||||
public init(latitude: Double, longitude: Double) {
|
||||
self.latitude = latitude
|
||||
self.longitude = longitude
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import Foundation
|
||||
|
||||
public struct CurrentLocation: Sendable, Hashable {
|
||||
public let coordinate: Coordinate
|
||||
public let name: String
|
||||
|
||||
public init(coordinate: Coordinate, name: String) {
|
||||
self.coordinate = coordinate
|
||||
self.name = name
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import Foundation
|
||||
|
||||
public enum LocationServiceError: Error, Sendable, Hashable {
|
||||
case authorizationDenied
|
||||
case locationUnavailable(reason: String)
|
||||
case geocodingFailed(reason: String)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import Foundation
|
||||
|
||||
public protocol LocationService: Sendable {
|
||||
func requestAuthorization() async
|
||||
func getCurrentLocation() async throws -> CurrentLocation
|
||||
}
|
||||
Reference in New Issue
Block a user