MapKit: Customize view shown by .mapFeatureSelectionAccessory

Hello,

Probably a noob question but I can't find any example code around this use case, and really no past questions I could find that address it either.

So, I really love that, when a user taps a POI on the map in my app, the map figures out the right POI every time. Flawless. However, when using .mapFeatureSelectionAccessory, I've tried probably 10-12 iterations, and there doesn't seem to be any way to either:

a) add custom content to the place card that's shown, or b) replace that place card altogether with a view of my own, or c) capture the place data but use it in a custom view

I want to be able to leverage the accuracy of Apple's tap gesture detection, but show, for example, only the name of the place, along with buttons and a form I have in a view.

Right now if I'm using .mapFeatureSelectionAccessory, I can't seem to bypass the place card at all.

Most of what you're looking for here isn't possible with the APIs that are currently available. To be specific:

a) add custom content to the place card that's shown,

The API does not support customization of this UI element.

b) replace that place card altogether with a view of my own

As related to the mapFeatureSelectionAccessory, that is not possible.

c) capture the place data but use it in a custom view

If you have a MKMapItem, that class has properties to get the name, phone number, and website URL, which you can use to show In a UI of your own design.

Enhancement requests are always welcome, so if you can detail what you're looking to do that goes beyond the current API capabilities with concrete details for your use cases, please file those in Feedback Assistant.

— Ed Ford,  DTS Engineer

MapKit: Customize view shown by .mapFeatureSelectionAccessory
 
 
Q