Using a similar function but I'm not getting the expected result. The map doesn't show the bay area. Thoughts?
struct MapViewContainer: UIViewRepresentable {
typealias UIViewType = MKMapView
let mapView = MKMapView()
func makeUIView(context: Context) -> MKMapView {
let mapView = MKMapView()
setupRegionForMap(withCoordinates: CLLocationCoordinate2D(latitude: 37.7776, longitude: -122.427290))
return mapView
}
func updateUIView(_ uiView: MKMapView, context: Context) {
}
func setupRegionForMap(withCoordinates coordinate: CLLocationCoordinate2D) {
let coordinateSpan = MKCoordinateSpan(latitudeDelta: 0.1, longitudeDelta: 0.1)
let region = MKCoordinateRegion(center: coordinate, span: coordinateSpan)
mapView.setRegion(region, animated: true)
}
}