---
title: "mapView(_:selectionAccessoryFor:)"
framework: mapkit
role: symbol
role_heading: Instance Method
path: "mapkit/mkmapviewdelegate/mapview(_:selectionaccessoryfor:)"
---

# mapView(_:selectionAccessoryFor:)

Specifies the accessory to display for a selected annotation

## Declaration

```swift
optional func mapView(_ mapView: MKMapView, selectionAccessoryFor annotation: any MKAnnotation) -> MKSelectionAccessory?
```

## Parameters

- `mapView`: The map view that requests the selection accessory.
- `annotation`: The annotation.

## Discussion

Discussion Called for all selected annotations. Not all types of annotations support displaying selection accessories. For example, the map item detail selection accessory is only supported for MKMapItemAnnotation and MKMapFeatureAnnotation. Please return `nil` for annotations where a selection accessory is not desired. No accessory will be displayed if… nil is returned mapView(_:selectionAccessoryFor:) is not implemented the accessory returned is not supported for `annotation`

## See Also

### Managing the display of overlays

- [mapView(_:rendererFor:)](mapkit/mkmapviewdelegate/mapview(_:rendererfor:).md)
- [mapView(_:didAdd:)](mapkit/mkmapviewdelegate/mapview(_:didadd:)-793gj.md)
- [mapView(_:viewFor:)](mapkit/mkmapviewdelegate/mapview(_:viewfor:)-6j267.md)
- [mapView(_:didAddOverlayViews:)](mapkit/mkmapviewdelegate/mapview(_:didaddoverlayviews:).md)
