<!--
{
  "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/mapControlVisibility(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewP08_MapKit_aB0E20mapControlVisibilityyQrAA0H0OF"
  },
  "title" : "mapControlVisibility(_:)"
}
-->

# mapControlVisibility(_:)

Configures all Map controls in the environment to have the specified
visibility

```
@MainActor @preconcurrency func mapControlVisibility(_ visibility: Visibility) -> some View
```

## Parameters

`visibility`

how modified map controls should show or hide

## Discussion

MapCompass, MapScaleView, and MapPitchToggle may automatically show and
hide based on the current state of the Map. That may not be appropriate
for all use cases, where always showing a control may be desirable.

```
HStack {
    MapCompass()
    MapScaleView()
    MapPitchToggle()
}
.mapControls(.visible)
```

Other controls don’t have an automatic visibility behavior, so they will
always be visible when automatic is specified. Controls may also be
hidden via this modifier when conditionalizing the view is not
appropriate

```
MapUserLocationButton()
    .mapControls(.automatic)
MapZoomStepper()
    .mapControls(.hidden)
```

---

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)