Hi , I'm trying to teach myself the new Mapkit code. Can someone help me fix the code below:
I'm getting the following error on Line 19: Initializer 'init(coordinateRegion:interactionModes:showsUserLocation:userTrackingMode:annotationItems:annotationContent:)' requires that 'Marker<Text>' conform to 'MapAnnotationProtocol'
import MapKit
struct IdentifiableAnnotation: Identifiable {
let id = UUID()
var annotation: MKPointAnnotation
}
struct ContentView: View {
@ObservedObject var locationManager: LocationManager
@State private var showUserProfile = false
@State private var showNotifications = false
@State private var showFriendz = false
@State private var courtAnnotations: [IdentifiableAnnotation] = []
var body: some View {
NavigationView {
ZStack(alignment: .bottom) {
Map(coordinateRegion: $locationManager.region,
interactionModes: .all,
showsUserLocation: true,
userTrackingMode: .none,
annotationItems: courtAnnotations) { item in
Marker(<#LocalizedStringKey#>, coordinate: item.annotation.coordinate)
}
.edgesIgnoringSafeArea(.all)