Instance Method


Returns a reusable annotation view using the specified identifier.


func dequeueReusableAnnotationView(withIdentifier identifier: String, for annotation: MKAnnotation) -> MKAnnotationView



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.

Return Value

An annotation view with the specified identifier.


For performance reasons, you should reuse MKAnnotationView 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(_:forAnnotationViewWithReuseIdentifier:) method. If a class with the appropriate identifier has not been registered, this method throws an exception.

See Also

Creating Annotation Views

func register(AnyClass?, forAnnotationViewWithReuseIdentifier: String)

Registers an annotation view class that the map can create automatically.

func dequeueReusableAnnotationView(withIdentifier: String) -> MKAnnotationView?

Returns a reusable annotation view located by its identifier.

func view(for: MKAnnotation) -> MKAnnotationView?

Returns the annotation view associated with the specified annotation object, if any.

let MKMapViewDefaultAnnotationViewReuseIdentifier: String

The default reuse identifier for your map's annotation views.

let MKMapViewDefaultClusterAnnotationViewReuseIdentifier: String

The default reuse identifier for the annotation view representing a cluster of annotations.