MapKit does not scale on iPad

I'm very frustrated. Why does the code work on the iPhone but iPad completely disregards anything code modifying MapKit?

import SwiftUI

import MapKit



struct MapView: View {

    var coordinate: CLLocationCoordinate2D

    @State private var region = MKCoordinateRegion()



    var body: some View {

        Map(coordinateRegion: $region)

        .edgesIgnoringSafeArea(.all)

        .frame(maxWidth: .infinity, maxHeight: .infinity)

            .onAppear {

                setRegion(coordinate)

            }

    }



    private func setRegion(_ coordinate: CLLocationCoordinate2D) {

        region = MKCoordinateRegion(

            center: coordinate,

            span: MKCoordinateSpan(latitudeDelta: 0.2, longitudeDelta: 0.2)

        )

    }

}



struct MapView_Previews: PreviewProvider {

    static var previews: some View {

        MapView(coordinate: CLLocationCoordinate2D(latitude: 34.000, longitude: -116.000))

        .previewDevice(PreviewDevice(rawValue: "iPhone 12 Pro Max"))

    }

}

struct MapView: View {

  @State private var region = MKCoordinateRegion(

    center: CLLocationCoordinate2D(

      latitude: 34.000,

      longitude: -116.000),

    span: MKCoordinateSpan(

      latitudeDelta: 0.03,

      longitudeDelta: 0.03)

  )

  

  var body: some View {

      Map(coordinateRegion: $region)

      .edgesIgnoringSafeArea(.all)

    }

  }

also does not work as intended

I tested your code with Xcode 14.5ß5.

I got the expected results:

Have you set the correct Supported destinations ?

MapKit does not scale on iPad
 
 
Q