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

# MapScaleView

Displays a legend with distance information for the associated map.

```
@MainActor @preconcurrency struct MapScaleView
```

## Overview

You can use this with [`Map`](/documentation/MapKit/Map) as a standalone view, for example:

```swift
    struct ScaleTestView: View {
        @Namespace var mapScope

        var body: some View {
            VStack {
                Map(scope: mapScope)
                MapCompass(scope: mapScope)
            }
            .mapScope(mapScope)
        }
    }
```

The scale indicator grows and shrinks (although visually, its frame is static) based on the zoom level of the map. By default the leading edge remains anchored and the trailing edge moves as the scale changes. If the scale is trailing aligned, then it may be more visually appealing to anchor the `ScaleView` to the trailing edge

```swift
    ZStack(alignment: .trailing) {
        Map(mapScope)
        MapScaleView(anchorEdge: .trailing, scope: mapScope)
    }
    .mapScope(mapScope)
```

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

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

## Topics

### Creating a map scale view

[`init(anchorEdge:scope:)`](/documentation/MapKit/MapScaleView/init(anchorEdge:scope:))

Creates a map scale view.

[`init(alignment:scope:)`](/documentation/MapKit/MapScaleView/init(alignment:scope:))

Creates a scale view with the provided alignment and scope.

### 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)