Apple Maps annotations and markers

In Apple's Maps app, an annotation is made up of a circle shape or rounded rectangles with a glyph-image.

When selecting an annotation, the annotation animates into a balloon marker (see attached GIF).

How does Apple Maps solve this - from custom annotation to balloon marker with spring animation?

I switched my Maps implementation from SwiftUI to UIKit with a UIViewRepresentable to support annotation clustering - and it works beautifully.

But how to subclass an MKAnnotationView (or MKMarkerAnnotationView <- the balloon) to enable selection and animation as in Apple Maps?

MKMarkerAnnotationView only show balloon markers and I tried everything inside MKAnnotationView (CALayer, etc.)

But how to subclass an MKAnnotationView (or MKMarkerAnnotationView <- the balloon) to enable selection and animation as in Apple Maps?

If you're looking to automatically animate the selection of a point of interest, that is possible through the family of selection APIs for points of interest on the map. There's a sample code project where you can see that. I suggest you run the sample on an iPad to see what I mean, as on iPhone, the animation happens to be hidden underneath the presentation of a sheet.

For your own annotations, MKMapDelegate has APIs that enable selection of annotations. Over in MKAnnotationView, there also are APIs for the view's current selection state which you can use in your subclass to handle selection animation

— Ed Ford,  DTS Engineer.

Apple Maps annotations and markers
 
 
Q