I am trying to implement a turn by turn navigation system in iOS using MKDirections API. I am able to get the directions of the route and can draw the polyline on the map, and when navigation starts the app start showing the instructions using the MKRouteStep object in Steps array. Now the problem is, since the distance in the MKRouteStep object is the distance that the user covers while traversing the path of the step I am unable to identify how to calculate this distance. Is there any way to calculate this distance ? Currently I am calculating the distance between two coordinates i.e the coordinate when last instruction was shown with the current location of user and if this distance is equal to the distance mentioned in MKRouteStep I am showing the next instruction, due to which it is delaying the instruction to be delivered to user.
If there is any way to identify the coordinate or region where this MKRouteStep ends I can calculate whether the user is in that region or not and then show the next instruction. May be this can work what are your thoughts, but for this how will I know the coordinate or region where this MKRouteStep ends from polyline array of MKRouteStep?
Please suggest if there is any other good solution for this. Any help is highly appreciated.
Thanks.