Update geo documentation
This commit is contained in:
parent
46de9ae0d4
commit
9a1c070e3e
|
@ -12,11 +12,17 @@ public class AppleMapsService: ExternalMapService {
|
||||||
|
|
||||||
public init() {}
|
public init() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the external url of a certain coordinate.
|
||||||
|
*/
|
||||||
public func getUrl(for coordinate: CLLocationCoordinate2D) -> URL? {
|
public func getUrl(for coordinate: CLLocationCoordinate2D) -> URL? {
|
||||||
let string = "http://maps.apple.com/maps?ll=\(coordinate.latitude),\(coordinate.longitude)"
|
let string = "http://maps.apple.com/maps?ll=\(coordinate.latitude),\(coordinate.longitude)"
|
||||||
return URL(string: string)
|
return URL(string: string)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the external url of a certain navigation.
|
||||||
|
*/
|
||||||
public func getUrl(from: CLLocationCoordinate2D, to: CLLocationCoordinate2D) -> URL? {
|
public func getUrl(from: CLLocationCoordinate2D, to: CLLocationCoordinate2D) -> URL? {
|
||||||
let string = "http://maps.apple.com/maps?saddr=\(from.latitude),\(from.longitude)&daddr=\(to.latitude),\(to.longitude)"
|
let string = "http://maps.apple.com/maps?saddr=\(from.latitude),\(from.longitude)&daddr=\(to.latitude),\(to.longitude)"
|
||||||
return URL(string: string)
|
return URL(string: string)
|
||||||
|
|
|
@ -15,6 +15,13 @@ import CoreLocation
|
||||||
*/
|
*/
|
||||||
public protocol ExternalMapService {
|
public protocol ExternalMapService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the external url of a certain coordinate.
|
||||||
|
*/
|
||||||
func getUrl(for coordinate: CLLocationCoordinate2D) -> URL?
|
func getUrl(for coordinate: CLLocationCoordinate2D) -> URL?
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the external url of a certain navigation.
|
||||||
|
*/
|
||||||
func getUrl(from: CLLocationCoordinate2D, to: CLLocationCoordinate2D) -> URL?
|
func getUrl(from: CLLocationCoordinate2D, to: CLLocationCoordinate2D) -> URL?
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,11 +12,17 @@ public class GoogleMapsService: ExternalMapService {
|
||||||
|
|
||||||
public init() {}
|
public init() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the external url of a certain coordinate.
|
||||||
|
*/
|
||||||
public func getUrl(for coordinate: CLLocationCoordinate2D) -> URL? {
|
public func getUrl(for coordinate: CLLocationCoordinate2D) -> URL? {
|
||||||
let string = "comgooglemaps://?center=\(coordinate.latitude),\(coordinate.longitude)"
|
let string = "comgooglemaps://?center=\(coordinate.latitude),\(coordinate.longitude)"
|
||||||
return URL(string: string)
|
return URL(string: string)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the external url of a certain navigation.
|
||||||
|
*/
|
||||||
public func getUrl(from: CLLocationCoordinate2D, to: CLLocationCoordinate2D) -> URL? {
|
public func getUrl(from: CLLocationCoordinate2D, to: CLLocationCoordinate2D) -> URL? {
|
||||||
let string = "comgooglemaps://?saddr=\(from.latitude),\(from.longitude)&daddr=\(to.latitude),\(to.longitude)"
|
let string = "comgooglemaps://?saddr=\(from.latitude),\(from.longitude)&daddr=\(to.latitude),\(to.longitude)"
|
||||||
return URL(string: string)
|
return URL(string: string)
|
||||||
|
|
|
@ -20,7 +20,14 @@ public struct WorldCoordinate: Identifiable, Hashable {
|
||||||
|
|
||||||
public var id: String { name }
|
public var id: String { name }
|
||||||
|
|
||||||
|
/**
|
||||||
|
The name of the coordinate.
|
||||||
|
*/
|
||||||
public let name: String
|
public let name: String
|
||||||
|
|
||||||
|
/**
|
||||||
|
The coordinate value.
|
||||||
|
*/
|
||||||
public let coordinate: CLLocationCoordinate2D
|
public let coordinate: CLLocationCoordinate2D
|
||||||
|
|
||||||
public static func == (lhs: WorldCoordinate, rhs: WorldCoordinate) -> Bool {
|
public static func == (lhs: WorldCoordinate, rhs: WorldCoordinate) -> Bool {
|
||||||
|
|
Loading…
Reference in New Issue