I wonder if there is a tap listener for polylines drawn in Google Map. The marker's tap is this:
func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool {
return false
}
Is there any equivalent function for polylines? I believe in Google Maps version 3 for web, you have the ability to add event listener for polylines like this:
google.maps.event.addListener(elines[i], 'click', function()
{
lineClick(this);
});
Thanks!
Is this also possible in ios/swift?
You can use isTappable
property of GMSPolyline.
isTappable
If this overlay should cause tap notifications.
polyline.isTappable = true
Whenever the polyline is tapped, the GMSMapViewDelegate method didTapOverlay is called
func mapView(_ mapView: GMSMapView, didTap overlay: GMSOverlay) {
//Write your code here
}
For further information refer https://developers.google.com/maps/documentation/ios-sdk/reference/protocol_g_m_s_map_view_delegate-p.html#a3a2bf2ff4481528f931183cb364c0f4b