<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/mapControls(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewP08_MapKit_aB0E11mapControlsyQrqd__yXEAaBRd__lF"
  },
  "title" : "mapControls(_:)"
}
-->

# mapControls(_:)

Configures all `Map` views in the associated environment to have
standard size and position controls

```
@MainActor @preconcurrency func mapControls(@ViewBuilder _ content: () -> some View) -> some View
```

## Parameters

`content`

A view builder returning the controls you wish your `Map`

## Discussion

You provide the controls you want to appear atop your map. When using a
control in conjunction with `.mapControls` you don’t need to specify a
scope. Views that are not MapKit controls will be ignored.

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

Controls can be modified individually or all at once. Custom frames and
alignments set on controls are ignored.

```
Map()
.mapControls {
    MapCompass()
        .mapControls(.visible)
    MapPitchToggle()
        .buttonBorderShape(.circular)
        .tint(.purple)
}
.controlSize(.large)
```

On watchOS, space is at a premium. When using the mapControls modifier,
MapUserLocationButton and MapCompass are automatically combined if present.

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

---

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)