MeasurementFormatter preferred unit

We would like to show jump height as 31 cm instead of 0.3 m, but formatter insists on 0.3m when we select option natural scale and use metric system:

Code Block
        var measurement = Measurement(value: 0.31, unit: UnitLength.meters)
        formatter.unitOptions = [.naturalScale]
        print(formatter.string(from: measurement))


same output with cm:
Code Block
        var measurement = Measurement(value: 31, unit: UnitLength.centimeters)
        formatter.unitOptions = [.naturalScale]
        print(formatter.string(from: measurement))


and without natural scale we get "0 km"

How we can configure formatter to display 31 cm?
Use .providedUnit :
Code Block
measurement = Measurement(value: 0.31, unit: UnitLength.centimeters)
// Or measurement.convert(to: UnitLength.centimeters)
formatter.unitOptions = [.providedUnit]
print(formatter.string(from: measurement))

I tested the following:
Code Block
var formatter = MeasurementFormatter()
formatter.locale = Locale(identifier: "fr-fr")
var measurement = Measurement(value: 0.31, unit: UnitLength.meters)
formatter.unitOptions = [.naturalScale]
print(formatter.string(from: measurement))
measurement.convert(to: UnitLength.centimeters)
formatter.unitOptions = [.providedUnit]
print(formatter.string(from: measurement))

and got:
0,31 m
31 cm

MeasurementFormatter preferred unit
 
 
Q