How to get current zoom level from google map for ios?

I use method camera with digital value like this:

camera = [GMSCameraPosition cameraWithLatitude:37.35 longitude:-122.0 zoom:6];

and I need automatically redraw map with current position via timer:

    [locationManager startUpdatingLocation];
    NSLog(@"lat %f, lon %f", locationManager.location.coordinate.latitude, locationManager.location.coordinate.longitude);
    camera = [GMSCameraPosition cameraWithLatitude:locationManager.location.coordinate.latitude//37.36//-37.81319//-33.86
                                              zoom:6]; = camera;

    [NSTimer scheduledTimerWithTimeInterval:0.5

but how I can get current zoom if I change it via touch?


OK, I find solution, get current zoom:

CGFloat currentZoom =;

and then use it in camera:

camera = [GMSCameraPosition cameraWithLatitude:locationManager.location.coordinate.latitude
                                          zoom:currentZoom]; = camera;

If you want to detect Zoom level while user is interacting with map. We can use Google Map delegate Method

func mapView(_ mapView: GMSMapView, didChange position: GMSCameraPosition) {
    let zoom =
    print("map zoom is ",String(zoom))

Dont forgot to add GMSMapViewDelegate

You could use animateToZoom too.


my two cents for swift 4.x:

let currZoom =

BUT is a Float, NOT a CGFloat, as in first objC sample. In Swift a Float is NOT a CGFloat.

Need Your Help

jekyll debug or print all variables

ruby debugging jekyll

I want to peak into Jekyll's brain and see what's going on, in php you have get_defined_vars, so I tried to do something akin to that with:

How to change background color of the snackbar?

android material-design android-dialogfragment android-snackbar

I am showing snackbar in DialogFragment Within the Positive click of alertDialog. Here is my code snippet.