Animate Map to Location is Not Working Google Maps iOS
In my case the map wasn't updating because I was not calling the method on the main queue. The following code solved the issue:
DispatchQueue.main.async { self.mapView.animate(to: camera) }
Anything action related to the user interface should be called in the main queue
Try this way
let cameraPosition = GMSCameraPosition.camera(withLatitude: place.latitude, longitude: place.longitude, zoom: 15.0)mapView.animate(to: cameraPosition)
Edit: Issue is you aren't having the reference of your map with your mapView object, change your viewDidLoad
's line:
view = mapView
TO:
// sets up the map view (camera, location tracker etc.)let camera = GMSCameraPosition.camera(withLatitude: place.latitude, longitude: place.longitude, zoom: 17.0)let mapView = GMSMapView.map(withFrame: view.bounds, camera: camera)mapView.isMyLocationEnabled = truemapView.delegate = selfself.mapView = mapViewview.addSubview(self.mapView)