Post

Replies

Boosts

Views

Activity

Reply to Autorefresh MapPolyline when route data grows
In ContentView, use an array of MKPolylines, manage them in some function that adds/removes polylines based on user interaction, and then place them in the Map() in a ForEach loop. It may not be as efficient as they claim MKMultiPolyline to be, but it gets n-number of polylines on the map. Top of the ContentView struct: @State private var multiPolylines = [MKPolyline]() Using them in the Map: Map() { ForEach(multiPolylines, id:\.self) { polyline in MapPolyline(polyline) .stroke(.pink, lineWidth: 3) } }
Jun ’23