MapLocationCompass
A view that displays a combined user location button and map compass.
Declaration
@MainActor @preconcurrency struct MapLocationCompassOverview
In watchOS 10 and later, this view displays a combined MapUserLocationButton and MapCompass control. When the map camera has a heading of zero (where north is up), this view shows the user location button. When the map camera is in a rotated state, it shows a compass.
Use MapLocationCompass in conjunction with Map as a standalone view, as shown in this example:
struct LocationCompassTestView: View {
@Namespace var mapScope
var body: some View {
VStack {
Map(scope: mapScope)
MapLocationCompass(scope: mapScope)
}
.mapScope(mapScope)
}
}You can also use MapLocationCompass in conjunction with the mapControls(_:) modifier. For example:
Map()
.mapControls {
MapLocationCompass()
}