Instance Method


Asks the delegate for the overlay view to use when displaying the specified overlay object.


optional func mapView(_ mapView: MKMapView, viewFor overlay: MKOverlay) -> MKOverlayView



The map view that requested the overlay view.


The object representing the overlay that is about to be displayed.

Return Value

The view to use when presenting the specified overlay on the map. If you return nil, no view is displayed for the specified overlay object.


Prior to iOS 7, you would implement this method to provide the views for your overlay objects.

See Also

Managing the Display of Overlays

func mapView(MKMapView, rendererFor: MKOverlay) -> MKOverlayRenderer

Asks the delegate for a renderer object to use when drawing the specified overlay.

func mapView(MKMapView, didAdd: [MKOverlayRenderer])

Tells the delegate that one or more renderer objects were added to the map.

func mapView(MKMapView, didAddOverlayViews: [Any])

Tells the delegate that one or more overlay views were added to the map.