FormatStyle
for Measurement
has this special case for UnitTemparature
:
https://developer.apple.com/documentation/foundation/formatstyle/3870095-measurement
All others is generic of UnitType
:
https://developer.apple.com/documentation/foundation/formatstyle/3870096-measurement
Is there anyway to save an instance of Measurement.FormatStyle
and apply it to any UnitType
?
let formatStyle = Measurement.FormatStyle() // <== how to create this?
// then use `formatStyle` on any Measurement:
let weight = Measurement(value: 1, unit: UnitMass.kilogram)
let length = Measurement(value: 2, unit: UnitLength.meter)
wight.formatted(formatStyle)
length.formatted(formatStyle)