I am able to set limited area to show at google map for user. After setting below code google map is not moving outside of this area defined with below code in Android: -
final LatLngBounds ADELAIDE = new LatLngBounds(
new LatLng(25.27, 93.46), new LatLng(27.05, 95.19));
// Constrain the camera target to the Adelaide bounds.
mMap.setMinZoomPreference(6.0f);
mMap.setLatLngBoundsForCameraTarget(ADELAIDE);
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(26.05839, 94.45399), 6.0f));
Now I am trying to implement same feature to restrict user for google map area in Swift but there is no method like setLatLngBoundsForCameraTarget
.
I have tried below code: -
let southWest = CLLocationCoordinate2DMake(25.27,93.46)
let northEast = CLLocationCoordinate2DMake(27.05,95.19)
let bounds = GMSCoordinateBounds(coordinate: northEast, coordinate: southWest)
let cameraBounds = googleMapView.camera(for: bounds, insets: UIEdgeInsets.zero)
googleMapView.camera = cameraBounds!
but this is not working. User still can move outside of this bounds. Please help. Thanks in advance.