MapCompass
A view that reflects the current orientation of the associated map.
Declaration
@MainActor @preconcurrency struct MapCompassOverview
You can use MapCompass with a Map as a stand alone view, as shown in the following example:
struct CompassButtonTestView: View {
@Namespace var mapScope
var body: some View {
VStack {
Map(scope: mapScope)
MapCompass(scope: mapScope)
}
.mapScope(mapScope)
}
}You can also use MapCompass with the Map/mapControls(_:), modifier, as shown below:
Map()
.mapControls {
MapCompass()
}Tapping the compass reorients the map so that North is at the top of the Map view.