Setting Map Type on MKMapView
With iOS 16, there is a new way to set the map type on the MKMapView
object. The map type determines how the map displays - is the map showing streets, satellite imagery, or a hybrid view?
Showing the standard view:
if #available(iOS 16, *) {
mapView.preferredConfiguration = MKStandardMapConfiguration()
} else {
mapView.mapType = .standard
}
The hybrid view:
if #available(iOS 16, *) {
mapView.preferredConfiguration = MKHybridMapConfiguration()
} else {
mapView.mapType = .hybrid
}
And last, the satellite view:
if #available(iOS 16, *) {
mapView.preferredConfiguration = MKImageryMapConfiguration()
} else {
mapView.mapType = .satellite
}
Note the change in terminology from satellite to imagery in iOS 16.