<!--
{
  "availability" : [
    "iOS: 4.0.0 - 13.0.0",
    "iPadOS: 4.0.0 - 13.0.0",
    "macCatalyst: 13.1.0 - 13.1.0"
  ],
  "documentType" : "symbol",
  "framework" : "MapKit",
  "identifier" : "/documentation/MapKit/MKMapViewDelegate/mapView(_:viewFor:)-6j267",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "MapKit"
    ],
    "preciseIdentifier" : "c:objc(pl)MKMapViewDelegate(im)mapView:viewForOverlay:"
  },
  "title" : "mapView(_:viewFor:)"
}
-->

# mapView(_:viewFor:)

Asks the delegate for the overlay view to use when displaying the specified overlay object.

```
optional func mapView(_ mapView: MKMapView, viewFor overlay: any MKOverlay) -> MKOverlayView
```

## Parameters

`mapView`

The map view that requests the overlay view.

`overlay`

The object representing the overlay that the map view is about to display.

## Return Value

The view to use when presenting the specified overlay on the map. If you return `nil`, no view  displays for the specified overlay object.

---

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)