Returns a reusable annotation view using the specified identifier.
- iOS 11.0+
- macOS 10.13+
- Mac Catalyst 13.0+
- tvOS 11.0+
A string identifying the annotation view to be created.
The annotation being displayed. This method automatically assigns this annotation object to the returned annotation view.
An annotation view with the specified identifier.
For performance reasons, you should reuse
MKAnnotation objects in your map views. As annotation views move offscreen, the map view moves them to an internally managed reuse queue. As new annotations move onscreen, and your code is prompted to provide a corresponding annotation view, use this method to dequeue an existing view. Dequeueing saves time and memory during performance-critical operations such as scrolling.
If an existing view cannot be dequeued, this method tries to create one from the specified identifier. For this to happen, you must have already registered an annotation view class using the
register(_: method. If a class with the appropriate identifier has not been registered, this method throws an exception.