Displays a legend with distance information for the associated `Map`
May be used in conjunction with `Map` as a stand alone view
struct ScaleTestView: View {
@Namespace var mapScope
var body: some View {
VStack {
Map(scope: mapScope)
MapCompass(scope: mapScope)
}
.mapScope(mapScope)
}
}
The scale indicator grows and shrinks (visually, its frame is static) based
on the zoom level of the map. By default the leading edge remains anchored
and the trailing edge moves as the scale changes. If the scale is trailing
aligned, then it may be more visually appealing for the ScaleView to be
anchored to the trailing edge
ZStack(alignment: .trailing) {
Map(mapScope)
MapScaleView(anchorEdge: .trailing, scope: mapScope)
}
.mapScope(mapScope)
MapScaleView may also be used in conjunction with the `.mapControls()` modifier
Map()
.mapControls {
MapScaleView()
}
Creates a map scale view.
- Parameters:
- anchorEdge: The fixed edge the scale grows and shrinks from. For use
outside of `.mapControls()`
- scope: The namespace passed to the associated Map and `.mapScope()`. For
use outside of `.mapControls()`