Skip to content

Instantly share code, notes, and snippets.

@ralfebert
Created September 14, 2021 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ralfebert/223190723fb4c771e5f5ce1670634b7a to your computer and use it in GitHub Desktop.
Save ralfebert/223190723fb4c771e5f5ce1670634b7a to your computer and use it in GitHub Desktop.
import MapKit
extension CLLocationCoordinate2D {
/// Returns the distance between two coordinates in meters.
func distance(to: CLLocationCoordinate2D) -> CLLocationDistance {
MKMapPoint(self).distance(to: MKMapPoint(to))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment