I'm trying to create turn-by-turn directions, and I want to create a follow effect. To do that I want the map camera heading to be pointed towards the next coordinate on the map. How would I find the heading from the user location to the next coordinate in MapKit with Swift?
The best way to accomplish this would be to use the following MKMapCamera initializer:
passing in the next maneuver's location as centerCoordinate and the user's location as eyeCoordinate. Then set MKMapView.camera to the resulting MKMapCamera.
Code Block convenience init(lookingAtCenter centerCoordinate: CLLocationCoordinate2D, fromEyeCoordinate eyeCoordinate: CLLocationCoordinate2D, eyeAltitude: CLLocationDistance)
passing in the next maneuver's location as centerCoordinate and the user's location as eyeCoordinate. Then set MKMapView.camera to the resulting MKMapCamera.