This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // DirectedPolylineViewController.swift | |
| // | |
| // | |
| // Created by Mac OS X on 11/02/2020. | |
| // Copyright © 2020 Muhammad Zeeshan. All rights reserved. | |
| // | |
| import UIKit | |
| import GoogleMaps |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func drawPolyline() { | |
| //Step 1: | |
| let coordinates = self.geoJson.map({CLLocationCoordinate2D(latitude: $0.last!, longitude: $0.first!)}) | |
| //Step 2: | |
| let chunkSize = 3 | |
| let chunkedCoordinates = coordinates.chunked(into: chunkSize) | |
| //Step 3: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var geoJson: [[CLLocationDegrees]] = [ | |
| [-118.2608582418, 34.0801788388], | |
| [-118.2605869562, 34.0800219712], | |
| [-118.2601800293, 34.0797865312], | |
| [-118.2596010753, 34.0794525362], | |
| [-118.2586218209, 34.078885827], | |
| [-118.2576888882, 34.0783437419], | |
| [-118.2567295072, 34.0777879666], | |
| [-118.2568708641, 34.0775788277], | |
| [-118.256982542, 34.0773834912], |
NewerOlder