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.

Solution 4: The grand pizza tour

Solution 4: The grand pizza tour - iOS Tutorial

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

Start my 1-month free trial

Solution 4: The grand pizza tour

- [Instructor] For this solution, you have everything you need in the Add Polylines Function. Go ahead and Stop the App. And let's Go Back To Add Polylines, and just above the addOverlays col, put this in, var coordinates, equals an array, CLLocation coordinate 2D. So what we're going to do is, we're going to collect all the points from the annotations using this array. So I'm going to do for location in annotations, which we had from above. And in there, coordinates.append and (location.coordinate). So we're just essentially going to go through all of our history annotations in order, and just get their coordinates and put them in an array. Now once we have that array, I can make a grand tour polyline, let grandTour = MKPolyline, with coordinates and count. The coordinates will be that array I just created of coordinates. And the count will just be coordinates.count. And then assign a title of the grandTour, grandTour.title, and we'll call it "GrandTour_Line". Now to show the…

Contents