Contents

MapPitchToggle

A button that sets the pitch of the associated map.

Declaration

@MainActor @preconcurrency struct MapPitchToggle

Overview

The MapPitchToggle control sets the pitch of the associated map to a pleasing angle if flat, or returns the map to flat if pitched.

You can use this control in conjunction with Map as a standalone view, as this example shows:

    struct MyMapView: View {
        @Namespace var mapScope

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

Alternatively, use MapPitchToggle in conjunction with the mapControls(_:) modifier. For example:

    Map()
        .mapControls {
            MapPitchToggle()
        }

Topics

Creating a map pitch toggle

See Also

Map controls