I'm following the official SwiftUI tutorial, using the latest Xcode (Version 15.0 beta 2, 15A5161b) so it's using iOS 17.0 beta. This is my code:
import SwiftUI
import MapKit
struct MapView: View {
@State private var region = MKCoordinateRegion(
center: CLLocationCoordinate2D(latitude: 34.011_284, longitude: -116.166_860),
span: MKCoordinateSpan(latitudeDelta: 0.2, longitudeDelta: 0.2)
)
var body: some View {
Map(coordinateRegion: $region)
}
}
struct MapView_Previews: PreviewProvider {
static var previews: some View {
MapView()
}
}
and this is the error I got for line 11 (Map(coordinateRegion: $region)
):
'init(coordinateRegion:interactionModes:showsUserLocation:userTrackingMode:)' was deprecated in iOS 17.0: Use Map initializers that take a MapContentBuilder instead.
I have no idea as to how to do this. Any help is appreciated.