How to zoom to fit many coordinates in Google Maps in iOS

Issue #463

func zoom(location1: CLLocation, location2: CLLocation) {
    let bounds = GMSCoordinateBounds(coordinate: location1.coordinate, coordinate: location2.coordinate)
    let update = GMSCameraUpdate.fit(bounds, withPadding: 16)
    mapView.animate(with: update)
}
Written by

I’m open source contributor, writer, speaker and product maker.

Start the conversation