Instance Method

exchangeOverlay(_:with:)

Exchanges the positions of the two overlay objects.

Declaration

func exchangeOverlay(_ overlay1: MKOverlay, with overlay2: MKOverlay)

Parameters

overlay1

The first overlay object.

overlay2

The second overlay object.

Discussion

If the overlays are in the same map level, they exchange positions within that level’s array of overlay objects. If they are in different map levels, the two objects also swap levels. Swapping the position of the overlays affects their visibility in the map view.

See Also

Adding and Inserting Overlays

func addOverlay(MKOverlay, level: MKOverlayLevel)

Adds the overlay object to the map at the specified level.

func addOverlays([MKOverlay], level: MKOverlayLevel)

Adds an array of overlay objects to the map at the specified level.

func addOverlay(MKOverlay)

Adds a single overlay object to the map.

func addOverlays([MKOverlay])

Adds an array of overlay objects to the map.

func insertOverlay(MKOverlay, at: Int, level: MKOverlayLevel)

Inserts an overlay object into the level at the specified index.

func insertOverlay(MKOverlay, at: Int)

Inserts an overlay object into the list associated with the map.

func insertOverlay(MKOverlay, above: MKOverlay)

Inserts one overlay object on top of another.

func insertOverlay(MKOverlay, below: MKOverlay)

Inserts one overlay object below another.

func exchangeOverlay(at: Int, withOverlayAt: Int)

Exchanges the position of two overlay objects.