I was finally able to get it to work in the following case:
@State private var selectedItem: MKMapItem?
@State private var selected: Feature?
Map(position: $position, selection: $selectedFeature) {
}
.mapFeatureSelectionDisabled { _ in false }
.mapFeatureSelectionContent { item in
Marker(item.title ?? "", coordinate: item.coordinate)
}
I had previously passed selectedItem to the selection parameter. Is it possible to allow selection of MKMapItems and MapFeatures?
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: