I have a Map within a SwiftUI.
I initialize a variable like this:
var cameraPosition: MapCameraPosition = .userLocation(followsHeading: true, fallback: .automatic)
and then I want to zoom map, code like this:
let userRegion = MKCoordinateRegion(
center: userLocation.coordinate,
span: MKCoordinateSpan(
latitudeDelta: 0.01,
longitudeDelta: 0.01
)
)
cameraPosition = .region(userRegion)
But it does't work. How can I solve this problem?