---
title: "exchangeOverlay(at:withOverlayAt:)"
framework: mapkit
role: symbol
role_heading: Instance Method
path: "mapkit/mkmapview/exchangeoverlay(at:withoverlayat:)"
---

# exchangeOverlay(at:withOverlayAt:)

Exchanges the position of two overlay objects at the specified index.

## Declaration

```swift
func exchangeOverlay(at index1: Int, withOverlayAt index2: Int)
```

## Parameters

- `index1`: The index of an overlay in the doc://com.apple.mapkit/documentation/MapKit/MKOverlayLevel/aboveLabels map level.
- `index2`: The index of another overlay in the doc://com.apple.mapkit/documentation/MapKit/MKOverlayLevel/aboveLabels map level.

## Discussion

Discussion If you need to exchange overlays in other map levels, use the exchangeOverlay(_:with:) method.

## See Also

### Adding and inserting overlays

- [addOverlay(_:level:)](mapkit/mkmapview/addoverlay(_:level:).md)
- [addOverlays(_:level:)](mapkit/mkmapview/addoverlays(_:level:).md)
- [addOverlay(_:)](mapkit/mkmapview/addoverlay(_:).md)
- [addOverlays(_:)](mapkit/mkmapview/addoverlays(_:).md)
- [insertOverlay(_:at:level:)](mapkit/mkmapview/insertoverlay(_:at:level:).md)
- [insertOverlay(_:at:)](mapkit/mkmapview/insertoverlay(_:at:).md)
- [insertOverlay(_:above:)](mapkit/mkmapview/insertoverlay(_:above:).md)
- [insertOverlay(_:below:)](mapkit/mkmapview/insertoverlay(_:below:).md)
- [exchangeOverlay(_:with:)](mapkit/mkmapview/exchangeoverlay(_:with:).md)
