One Logo Pool Ball
_MapKit_SwiftUI · IOS API REFERENCE

MapScaleView

struct · iOS 17.0+ · SDK 27.1

@MainActor @preconcurrency struct MapScaleView

Displays a legend with distance information for the associated `Map` May be used in conjunction with `Map` as a stand alone view 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 (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 for the ScaleView to be anchored to the trailing edge ZStack(alignment: .trailing) { Map(mapScope) MapScaleView(anchorEdge: .trailing, scope: mapScope) } .mapScope(mapScope) MapScaleView may also be used in conjunction with the `.mapControls()` modifier Map() .mapControls { MapScaleView() }

Members (2)

init · iOS 17.0+

init

TypeScript
static initAnchorEdgeScope(anchorEdge?: _SwiftUICore_HorizontalEdge, scope?: (_SwiftUICore_Namespace_ID) | null): Promise<MapScaleView>
Swift declaration
@MainActor @preconcurrency init(anchorEdge: HorizontalEdge = .leading, scope: Namespace.ID? = nil)

Creates a map scale view. - Parameters: - anchorEdge: The fixed edge the scale grows and shrinks from. For use outside of `.mapControls()` - scope: The namespace passed to the associated Map and `.mapScope()`. For use outside of `.mapControls()`

init · iOS 26.0+

init

TypeScript
static initAlignmentScope(alignment?: _SwiftUICore_HorizontalAlignment, scope?: (_SwiftUICore_Namespace_ID) | null): Promise<MapScaleView>
Swift declaration
@MainActor @preconcurrency init(alignment: HorizontalAlignment = .leading, scope: Namespace.ID? = nil)

Skipped declarations

1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

MapScaleView.body

This protocol needs associated types that cannot yet cross the bridge.

All _MapKit_SwiftUI types →