I'm trying to use several MapViews in my swiftui list (Xcode 11.2.1). It seems to be Ok to have 4 MapViews but 5 is too much. I get "precondition failure: invalid value type for attribute: 102" with 5 MapViews. Any ideas? Simplified code below.
import SwiftUI
import MapKit
struct ContentView: View {
var body: some View {
List {
MapView().frame(height: 300)
MapView().frame(height: 300)
MapView().frame(height: 300)
MapView().frame(height: 300)
MapView().frame(height: 300) //This is too much...
}
}
}
struct MapView: UIViewRepresentable {
func makeUIView(context: Context) -> MKMapView {
MKMapView()
}
func updateUIView(_ view: MKMapView, context: Context) {
}
}