mapControlVisibility(_:)
Configures all Map controls in the environment to have the specified visibility
Declaration
@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)See Also
Getting location information
LocationButtonMapmapStyle(_:)mapScope(_:)mapFeatureSelectionDisabled(_:)mapFeatureSelectionAccessory(_:)mapFeatureSelectionContent(content:)mapControls(_:)mapCameraKeyframeAnimator(trigger:keyframes:)lookAroundViewer(isPresented:scene:allowsNavigation:showsRoadLabels:pointsOfInterest:onDismiss:)lookAroundViewer(isPresented:initialScene:allowsNavigation:showsRoadLabels:pointsOfInterest:onDismiss:)onMapCameraChange(frequency:_:)mapItemDetailPopover(isPresented:item:displaysMap:attachmentAnchor:)mapItemDetailPopover(isPresented:item:displaysMap:attachmentAnchor:arrowEdge:)mapItemDetailPopover(item:displaysMap:attachmentAnchor:)