From the course: Advanced iOS App Development: MapKit & Core Location
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Display graphic directions - iOS Tutorial
From the course: Advanced iOS App Development: MapKit & Core Location
Display graphic directions
- [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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
-
(Locked)
Request directions6m 27s
-
(Locked)
Display graphic directions7m 38s
-
(Locked)
Display step-by-step directions6m 27s
-
(Locked)
Challenge 7: The chosen path27s
-
(Locked)
Solution 7: The chosen path1m 2s
-
(Locked)
Launching the maps app6m 34s
-
(Locked)
Final challenge: Transit ETA annotation45s
-
(Locked)
Final solution: Transit ETA annotation6m 14s
-
(Locked)
-