How do i add animation to drawn route in iOS map like Uber application doing now days

I tried to add flashing animation to drawn route in google map and native ios map but couldn’t able to achieve that one. Can anybody help me to do this one like uber application now days show flashing animation on drawn route on map from source to destination.

1 Like

rendererForOverlay is the function in which you provide a MKPolylineRenderer to draw the annotation. If you remove and then add an overlay it will be called each time to get a renderer for the overlay. So if you create a timer object that remove and adds a polyline you should be able to return the MKPolylineRenderer again, changing fillColor or strokeColor to give the appearance of flashing. There might be some experimentation required to give the desired effect - and I would have to try it to see if the drawing remains smooth enough to use, but that’s my first thought. If there is overhead associated with creating a MKPolylineRenderer then just create one once in your view controller and change the fillColor or strokeColor each time - you even get to use it as data storage then, to know what the last color used was so you can alter it slightly each time.

I will try your suggestion.

Can you help me to achieve this one? i tried but i dont see way to do with rendererForOverlay.

What’s happening - do you not get rendererForOverlay called again when re-adding the polyline annotation?

This project is available here

I have used Apple maps