<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.2.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MapKit",
  "identifier" : "/documentation/MapKit/MKMapView/exchangeOverlay(at:withOverlayAt:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "MapKit"
    ],
    "preciseIdentifier" : "c:objc(cs)MKMapView(im)exchangeOverlayAtIndex:withOverlayAtIndex:"
  },
  "title" : "exchangeOverlay(at:withOverlayAt:)"
}
-->

# exchangeOverlay(at:withOverlayAt:)

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

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

## Parameters

`index1`

The index of an overlay in the [`MKOverlayLevel.aboveLabels`](/documentation/MapKit/MKOverlayLevel/aboveLabels) map level.

`index2`

The index of another overlay in the [`MKOverlayLevel.aboveLabels`](/documentation/MapKit/MKOverlayLevel/aboveLabels) map level.

## Discussion

If you need to exchange overlays in other map levels, use the [`exchangeOverlay(_:with:)`](/documentation/MapKit/MKMapView/exchangeOverlay(_:with:)) method.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)