Instance Method


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


func view(for annotation: MKAnnotation) -> MKAnnotationView?



The annotation object whose view you want.

Return Value

The annotation view or nil if the view has not yet been created. This method may also return nil if the annotation is not in the visible map region and therefore does not have an associated annotation view.

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, for: MKAnnotation) -> MKAnnotationView

Returns a reusable annotation view using the specified identifier.

func dequeueReusableAnnotationView(withIdentifier: String) -> MKAnnotationView?

Returns a reusable annotation view located by its identifier.

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.