Mapkit Type

Hello, how can I turn this standard map view into a Satellite map view? Thanks


//  MapView.swift

//  Grindelwald View

//

//  Created by Roman Indermühle on 15.04.22.

//

import MapKit

import SwiftUI

struct City: Identifiable {

    let id = UUID()

    let name: String

    let coordinate: CLLocationCoordinate2D

}


struct MapView: View {

    

    @State private var region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 46.62407, longitude: 8.03434), span: MKCoordinateSpan(latitudeDelta: 0.17, longitudeDelta: 0.17))

    

    

    let annotations = [

        City(name: "Burglauenen", coordinate: CLLocationCoordinate2D(latitude: 46.63649, longitude: 7.97512)),

        City(name: "Stalden", coordinate: CLLocationCoordinate2D(latitude: 46.63937, longitude: 7.97216)),

        City(name: "Stalden2", coordinate: CLLocationCoordinate2D(latitude: 46.63873, longitude: 7.96684))

        

        

    ]

    

    

    var body: some View {

        Map(coordinateRegion: $region, annotationItems: annotations) {

            MapMarker(coordinate: $0.coordinate)

            

            

        }

        

        

    }

    

}





struct MapView_Previews: PreviewProvider {

    static var previews: some View {

        MapView()

    }

}
Answered by robnotyou in 711584022

The native SwiftUI Map is quite limited, it can't display a satellite view.
You will have to use a UIKit MKMapView, and wrap it in UIViewRepresentable.
(There are plenty of articles on the web explaining how to do this.)

Accepted Answer

The native SwiftUI Map is quite limited, it can't display a satellite view.
You will have to use a UIKit MKMapView, and wrap it in UIViewRepresentable.
(There are plenty of articles on the web explaining how to do this.)

Mapkit Type
 
 
Q