From the course: Advanced iOS App Development: MapKit & Core Location
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Final solution: Transit ETA annotation - iOS Tutorial
From the course: Advanced iOS App Development: MapKit & Core Location
Final solution: Transit ETA annotation
(tingly music) - [Narrator] I'll start this last solution to the challenges by commenting out the open maps. Now just under the if for transit, I'll calculate the ETA with directions dot calculate ETA and I'll launch that handler. Again I'll make this a response, this an error, and then I'll go into the code. I'm going to make an annotation first, let annotation equal pizza annotation. The coordinate will be the destination. The title will be destination. And the subtitle will be no transit available. Then once you've got that set up, unwrap the response. In that, change the annotation subtitle. I'm going to format this a little nicer than I have in the past and use a string and do format, percent four point two F will do a two digit number. And the value for that will be response, expected travel time divided by 60 because it's found in seconds. I'll tag this annotation as public transportation in the annotations identifier. This way I know to do something different with the button…
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.