Display the directions as a graphic route on the map.
- [Instructor] You've made a request and asked…the Apple servers to send you directions between two points.…In the closure for the calculate method,…you have a parameter response, which is…of type MKDirections response, and your directions.…You'll need to do a bit of unwrapping of this object,…depending on what you want on your map.…We'll start with tracing the route on the map.…The property response is optional.…So, unwrap it first.…
There's only three properties in MKDirections response,…your source and destination points,…and an array of routes named routes.…If you get this far, there will be…at least one route in this array.…Both response and error would be nil otherwise.…I'll get the routes and print the count to the console.…Let routes equal...…response dot...…routes.…And we can print the count out nice and simply.…
Print...…Backslash...…routes dot count.…After that, I'll loop through the routes…and put them on the map for...…route in...…routes.…MK routes has descriptive information,…like the name of the route, travel time and distance.…
- Getting coordinates from the web
- Working with Core Location data types and regions
- Creating a map in 2D, 3D, satellite, and flyover views
- Adding annotations
- Adding overlays
- Finding the current location
- Tracking heading, speed, and region
- Searching for locations
- Requesting and displaying directions
Skill Level Advanced
Advanced iOS Development: Working with APIswith Saul Mora1h 59m Intermediate
1. Basic Map and Location Concepts
5. Current Location
6. Heading, Speed, and Regions
Next steps1m 38s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.