Post

Replies

Boosts

Views

Created

ForEach loop in a Map doesn't work
Hi all, here's a tiny litte demo app import SwiftUI import MapKit struct MarkerData: Identifiable { var id = UUID() var coordinate: CLLocationCoordinate2D } struct MapView2: View { @State private var markers: [MarkerData] = [] var body: some View { ForEach(markers) { marker in Text("\(marker.coordinate)") } Map { ForEach(markers) { marker in MapMarker(coordinate: marker.coordinate) } } } } The ForEach loop inside the Map gives the error: "Generic parameter 'V' could not be inferred" The one above seems to be fine. What is wrong with the loop inside the map? (I'm working with XCode Version 16.2) Best!
4
0
409
Mar ’25