When you use Measurement, depending on the value given and the format, it will switch from a smaller suffix to a large suffix. Example: ft -> mi or m -> km.
Here it seems the suffix switches at 0.50 miles. I'm wondering if the "switch" point can be changed either higher or lower. It also seems the unit type doesn't make a difference.
struct ContentView: View {
var body: some View {
VStack {
Text(Measurement(value: 805, unit: UnitLength.meters)
.formatted(
.measurement(width: .abbreviated, usage: .road)
)
)
Text(Measurement(value: 804, unit: UnitLength.meters)
.formatted(
.measurement(width: .abbreviated, usage: .road)
)
)
Text(Measurement(value: 0.5, unit: UnitLength.miles)
.formatted(
.measurement(width: .abbreviated, usage: .road)
)
)
Text(Measurement(value: 0.499, unit: UnitLength.miles)
.formatted(
.measurement(width: .abbreviated, usage: .road)
)
)
}
}
}
