You may want to create latitude and longitude boundaries that restrict a user's movement in a 3D map, or to limit the camera's altitude, heading, or tilt. You can do this by configuring map and camera restrictions.
The following code sample demonstrates how to use the
Map.cameraRestrictions
method to restrict both the geographical boundaries of the camera and the
values of the camera's altitude, heading, and tilt.
struct CameraRestrictionDemo: View {
var body: some View {
Map(initialCamera: .sanFrancisco, mode: .hybrid)
.cameraRestrictions([
.bounds(latitude: 37.7...37.8, longitude: (-122.5)...(-122.4))
])
}
}