The shared infrastructure used to draw overlays on the map surface.
- iOS 7.0+
- macOS 10.9+
- tvOS 9.2+
An overlay renderer draws the visual representation of an overlay object—that is, an object that conforms to the
MKOverlay protocol. This class defines the drawing infrastructure used by the map view. Subclasses are expected to override the
draw(_: method to draw the contents of the overlay.
The Map Kit framework provides several concrete instances of overlay renderers. Specifically, it provides renderers for each of the concrete overlay objects. You can use one of these existing renderers or define your own subclasses if you want to draw the overlay contents differently.
You can subclass
MKOverlay to create overlays based on custom shapes, content, or drawing techniques. The only method subclasses are expected to override is the
draw(_: method. However, if your class contains content that may not be ready for drawing right away, you should also override the
can method and use it to report when your class is ready and able to draw.
The map view may tile large overlays and distribute the rendering of each tile to separate threads. Therefore, the implementation of your
draw(_: method must be safe to run from background threads and from multiple threads simultaneously.