Hi, does anyone have some short code to display a marker with callout? There simply is no updated documentation of it. They are either using old names or I just have not found any tutorial of it.
I only found about MapMarker, but then it only shows a pin. on the map and no callout is possible.
This is what I have
Map(coordinateRegion: $mapRegion, showsUserLocation: true, annotationItems: markers) { marker in
marker.location
}
Where marker.location is MarkerMap. So it displays a pin correctly, but how to add a callout and link to it?
There are so many different names that start with MK. I am not sure if those are the latest. I figure MapAnnotation, MapMarker to name a few are the latest ones.
To use callouts, you need to implement your map using MKMapView
rather than Map
. We have a sample code project showing callouts on a MKMapView. We'd also love if you could file a suggestion in Feedback Assistant for Map
to support callouts in the future.