位置相关的 API,旨在供服务器端 Swift 应用程序使用,因为 Linux 上没有 CoreLocation
。
do {
let prague = try GeoCoordinate2D(latitude: 50.0880400, longitude: 14.4207600)
let brno = try GeoCoordinate2D(latitude: 49.195060, longitude: 16.606837)
let distancePragueBrnoInMeters = prague.distance(from: brno)
print("Distance between Prague and Brno is \(distancePragueBrnoInMeters * 0.00062137) mi.")
} catch {
// Tried to create an instance of `GeoCoordinate2D` with invalid coordinates.
}
.Package(url: "https://github.com/petrpavlik/GeoSwift.git", majorVersion: 1)
MIT
Petr Pavlik - @ptrpavlik