I am trying to display all possible routes between points A and B in my Swift app (iOS 8+ target). I allow the user to select any one of the possible routes in my app. Next, I would like the user to be able to navigate the selected route (MKRoute) in Apple Maps app, using
var fullRouteResponse:MKDirectionsResponse? //This variable has MKRoute information
@IBAction func openInAppleMaps(sender: AnyObject)
{
let placemark = MKPlacemark(coordinate: destinationCoordinate!, addressDictionary: nil)
mapItem = MKMapItem(placemark: placemark)
mapItem.openInMapsWithLaunchOptions(
[MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving,
MKLaunchOptionsMapTypeKey: MKMapType.Standard.rawValue,
MKLaunchOptionsShowsTrafficKey: true ])
}
This opens up the Maps app fine, but I'm unable to figure out how to pass the specific selected MKRoute information so that the user doesn't have to re-select from all possible routes in Apple maps app.
I'm not sure if this is even possible, so any pointers would really help. Thanks!