An interface for associating content with a specific map region.
- iOS 4.0+
- macOS 10.9+
- tvOS 9.2+
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
add(_:) 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
map 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.