I am currently looking for a way to make a route (MGPLPolyline) tappable such that a user can choose between two possible routes under Mapbox. Unfortunately the route annotation doesn't seem to be tappable at all:
While i have properly set my MGLMapViewDelegate
this method:
func mapView(_ mapView: MGLMapView, didSelect annotation: MGLAnnotation)
is never invoked.
What did i miss knowing that each line inherited from MGLPolyline
which is a subclass of an MGLAnnotation
(which i was expected to be tappable...).
You could do the following:
First, when you create the polyline do the following:
Then in the following method return false:
The Mapbox iOS API doesn't support that yet, unfortunately. See here.
There are a couple of workarounds within that link that you could try though.
UPDATE: This is now possible: Check here.