CLLocation

extension CLLocation
  • Calculates the location coordinate for a given bearing and distance from this location as origin. https://www.movable-type.co.uk/scripts/latlong.html

    Declaration

    Swift

    public func locationCoordinate(withBearing bearingDegrees: Double, distanceMeters: Double) -> CLLocationCoordinate2D

    Parameters

    bearingDegrees

    Bearing in degrees

    distanceMeters

    Distance in meters

    origin

    Coordinate from which the result is calculated

    Return Value

    Location coordinate at the bearing and distance from origin coordinate.

  • Calculate the bearing from this location object to another

    Declaration

    Swift

    public func bearing(toLocation: CLLocation) -> CLLocationDirection

    Parameters

    toLocation

    target location

    Return Value

    Bearing in degrees.

  • Calcualtes the bearing angle from this location object to another with device heading

    Declaration

    Swift

    public func bearingAngleInRadians(toLocation: CLLocation, with heading: CLHeading) -> Double?

    Parameters

    toLocation

    to location point

    heading

    heading in degrees of device

    Return Value

    Bearing angle in radians.

  • Undocumented

    Declaration

    Swift

    public func translation(fromLocation location: CLLocation) -> simd_double3

vCard

  • Creates a Virtual Contact File (VCF) or vCard for the location.

    Declaration

    Swift

    public func vCard(name: String = "Location") -> URL?

    Return Value

    Local file path URL.

Strings

  • Pretty description of a distance from the location to another.

    Declaration

    Swift

    public func prettyDistanceDescription(fromLocation location: CLLocation, locale: Locale = Locale.current) -> String

    Parameters

    location

    Location from which to display distance.

    locale

    Locale to display the units of measurement.

    Return Value

    A pretty description string of a distance in the specified locale.