An interface for associating content with a specific map region.


protocol MKOverlay


Overlay objects are data objects that define the geographic data to cover. MapKit defines several concrete classes that adopt this protocol and define standard shapes such as rectangles, circles, and polygons. You might use overlays to define the geographic boundaries of a national park or trace a bus route along city streets. You add an overlay to your map view by calling its addOverlay(_:) method or any other map view method for adding overlays to the map. When the overlay's region intersects the visible portion of the map, the map view calls the mapView(_:rendererFor:) method of its delegate to obtain the renderer object responsible for drawing the overlay.

If you add an overlay to a map view as an annotation, instead of adding it as an overlay, the map view treats your overlay as an annotation. Specifically, it displays your overlay only when its coordinate is in the visible map region, rather than displaying the overlay when any portion of its covered area is visible.


Describing the Overlay Geometry

var coordinate: CLLocationCoordinate2D

The approximate center point of the overlay area.


var boundingMapRect: MKMapRect

The projected rectangle that encompasses the overlay.


Determining Map Intersections

func intersects(MKMapRect) -> Bool

Returns a Boolean indicating whether the specified rectangle intersects the receiver’s shape.

Optimizing Map Rendering

func canReplaceMapContent() -> Bool

Returns a Boolean indicating whether the overlay content replaces the underlying map content.

See Also

Annotations and Overlays

class MKPlacemark

A user-friendly description of a location on the map.

protocol MKAnnotation

An interface for associating your content with a specific map location.

class MKAnnotationView

The visual representation of one of your annotation objects.

class MKOverlayRenderer

The shared infrastructure used to draw overlays on the map surface.

MapKit Annotations

Use these annotation objects as-is in your maps.

MapKit Overlays

Use these overlays as-is in your maps.