formatted()
Generates a locale-aware string representation of a measurement using the default measurement format style.
Declaration
func formatted() -> StringReturn Value
A string, formatted according to the default style.
Discussion
Use the formatted() method to apply the default format style to a measurement, such as in the following example:
let string = Measurement<UnitTemperature>(value: 38, unit: .celsius).formatted()
// For locale: en_US: 100.4°FThe default measurement format style uses an abbreviated unit width, the general usage type, and the default number format style. To customize the formatted measurement string, use the formatted(_:) method and include a Measurement.FormatStyle.