Reputation: 163
I'm working on a project where I need to find the estimated travel time from the user location to a certain MKAnnotation. I would like to be able to see which annotation the user has clicked on so I can generate the ETA and display it on the annotationCalloutView using the "viewFor annotation" function.
This ETA cannot be calculated using a custom MKAnnotation class due throttling from Apple if done in this way: HERE So it must be done while the annotation callout is opening.
Upvotes: 1
Views: 64
Reputation: 38833
You have the mapView
delegate method:
func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) {
}
You have the parameter view
which is the clicked MKAnnotationView
and from that parameter you can access your annotation
.
Upvotes: 1