I want to get direction from google maps in swift. In my application, user can make two markers with LongTouch and i want to show direction between markers and also i get latitude and longitude of each marker. I am amateur and couldn't find code for this.
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
latitudeMarker = marker.position.latitude
longitudeMarker = marker.position.longitude
print(latitudeMarker)
print(longitudeMarker)
print("ok")
}
}
how can I use google maps to get direction and time?