unitString(fromKilograms:usedUnit:)
Returns the unit string for the provided value.
Declaration
func unitString(fromKilograms numberInKilograms: Double, usedUnit unitp: UnsafeMutablePointer<MassFormatter.Unit>?) -> StringParameters
- numberInKilograms:
The mass’s value in kilograms.
- unitp:
An output parameter. This will hold the Unit value that corresponds to the returned units.
Return Value
A localized string representing the unit.
Discussion
This method selects the correct unit based on the formatter’s locale, the magnitude of the value, and the isForPersonMassUse property. The value, once converted into the appropriate unit, determines whether the unit string is plural or singular.