I want to show direction between two markers that I had made. How can I do it? How can I show direction?
Here is my code that I used to make markers:
func mapView(mapView: GMSMapView, didLongPressAtCoordinate coordinate: CLLocationCoordinate2D) {
if counterMarker < 2
{
counterMarker += 1
let marker = GMSMarker(position: coordinate)
marker.appearAnimation = kGMSMarkerAnimationPop
marker.map = mapView
marker.position.latitude = coordinate.latitude
marker.position.longitude = coordinate.longitude
print(marker.position.latitude)
print(marker.position.longitude)
}
And here is the code for deleting markers on click:
func mapView(mapView: GMSMapView, didTapMarker marker: GMSMarker) -> Bool {
let alert = UIAlertController(title: "Alert", message: "Are you Sure for deleting ?!", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "No", style: UIAlertActionStyle.Default) {
UIAlertAction in
NSLog("No Pressed")
})
alert.addAction(UIAlertAction(title: "Yes", style: UIAlertActionStyle.Default) {
UIAlertAction in
NSLog("Yes Pressed")
marker.map = nil
self.counterMarker -= 1
})
self.presentViewController(alert, animated: true, completion: nil)
return true
}
And I like to show which marker is for destination and which one is for origin.