Created
May 31, 2020 11:22
-
-
Save ryanisnhp/f76eaab43a559632da131100aa82a8bd to your computer and use it in GitHub Desktop.
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
//STEP 2: - DRAW A ROUTE ON THE MAP | |
func drawRouteOnMap(route: String?) { | |
guard let route = route else {return} | |
guard let path = GMSPath(fromEncodedPath: route) else {return} | |
self.path = path | |
let polyline = GMSPolyline(path: path) | |
polyline.strokeColor = .gray | |
polyline.strokeWidth = 2 | |
polyline.map = mapView | |
// (Optional) Add bounds and insets to let the route is at the center of the map | |
let bounds = GMSCoordinateBounds(path: path) | |
let insets = UIEdgeInsets(top: 20, left: 40, bottom: 20, right: 40) | |
let camera = GMSCameraUpdate.fit(bounds, with: insets) | |
mapView.animate(with: camera) | |
//STEP 3: - ANIMATIONS | |
startAnimationTimer() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment