<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MapKit",
  "identifier" : "/documentation/MapKit/MapCompass",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "MapKit",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:15_MapKit_SwiftUI0A7CompassV"
  },
  "title" : "MapCompass"
}
-->

# MapCompass

A view that reflects the current orientation of the associated map.

```
@MainActor @preconcurrency struct MapCompass
```

## Overview

You can use `MapCompass` with a [`Map`](/documentation/MapKit/Map) as a stand alone view, as shown in the following example:

```swift
    struct CompassButtonTestView: View {
        @Namespace var mapScope
        var body: some View {
        VStack {
                Map(scope: mapScope)
                MapCompass(scope: mapScope)
            }
            .mapScope(mapScope)
        }
    }
```

You can also use `MapCompass` with the <doc://com.apple.documentation/documentation/SwiftUI/View/mapControls(_:)>, modifier, as shown below:

```swift
    Map()
        .mapControls {
            MapCompass()
        }
```

Tapping the compass reorients the map so that North is at the top of the [`Map`](/documentation/MapKit/Map) view.

## Topics

### Creating a map compass

[`init(scope:)`](/documentation/MapKit/MapCompass/init(scope:))

Creates a new map compass with the scope you specify.

### Managing map control sizing and visibility

  <doc://com.apple.documentation/documentation/SwiftUI/View/mapControlVisibility(_:)>

  <doc://com.apple.documentation/documentation/SwiftUI/View/mapControls(_:)>

  <doc://com.apple.documentation/documentation/SwiftUI/View/controlSize(_:)>

### Setting the namespace Identifier

  <doc://com.apple.documentation/documentation/SwiftUI/View/mapScope(_:)>



---

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)