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

Final solution: Transit ETA annotation - iOS Tutorial

From the course: Advanced iOS App Development: MapKit & Core Location

Start my 1-month free trial

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…

Contents