Post

Replies

Boosts

Views

Activity

When 500m is specified in MKCoordinateRegion, it stops with an error.
I used Xcode 14 Beta 2. It worked fine on Xcode 13. If you set it to 3000m as shown below, it will work without problems. Below is the sample code. import SwiftUI import MapKit enum MapType {   case standard   case satellite   case hybrid   case satelliteFlyover   case hybridFlyover   case mutedStandard } struct MapView: UIViewRepresentable {   let searchKey: String       let mapType: MapType   func makeUIView(context: Context) -> MKMapView {     return MKMapView()   }       func updateUIView(_ uiView: MKMapView, context: Context) {     switch mapType {     case .standard:       uiView.preferredConfiguration = MKStandardMapConfiguration(elevationStyle: .flat)             case .satellite:       uiView.preferredConfiguration = MKImageryMapConfiguration()     case .hybrid:       uiView.preferredConfiguration = MKHybridMapConfiguration()     case .satelliteFlyover:       uiView.preferredConfiguration = MKImageryMapConfiguration(elevationStyle: .realistic)     case .hybridFlyover:       uiView.preferredConfiguration = MKHybridMapConfiguration(elevationStyle: .realistic)     case .mutedStandard:       uiView.preferredConfiguration = MKStandardMapConfiguration(emphasisStyle: .muted)     }     let geocoder = CLGeocoder()           geocoder.geocodeAddressString(searchKey) { placemarks, error in       if let placemarks,         let firstPlaceMark = placemarks.first ,         let location = firstPlaceMark.location {                   let targetCoordinate = location.coordinate                   print(targetCoordinate)                   let pin = MKPointAnnotation()                   pin.coordinate = targetCoordinate                   pin.title = searchKey         uiView.addAnnotation(pin)         uiView.region = MKCoordinateRegion(center: targetCoordinate,                           latitudinalMeters: 3000.0,                           longitudinalMeters: 3000.0)       }     }   } }
3
0
2k
Jun ’22