---
title: "init(mapView:)"
framework: mapkit
role: symbol
role_heading: Initializer
path: "mapkit/mkcompassbutton/init(mapview:)"
---

# init(mapView:)

Creates a compass button and associates it with the specified map view.

## Declaration

```swift
convenience init(mapView: MKMapView?)
```

## Parameters

- `mapView`: The map to associate with the compass button. The compass button reflects the orientation of this map, and tapping the button reorients the map appropriately.

## Return Value

Return Value An initialized compass button.
