To get directions between a source and destination, perform the following steps:
- Let's continue using our demo to add a way to display directions between two locations.
- Go to storyboard and open our view controller to add a UIButton at the bottom with the title Directions. Add constraints to the button to stick it to the bottom, like this:
- Add an IBAction function, didClickOnDirections, to the button in ViewController.swift like this:
@IBAction func didClickOnDirections(_ sender: AnyObject) { }
- Update the didClickOnDirections function like this:
@IBAction func didClickOnDirections(_ sender: AnyObject) { let mapItem1 ...