Contents

unitString(fromJoules:usedUnit:)

Returns the unit string for the provided value.

Declaration

func unitString(fromJoules numberInJoules: Double, usedUnit unitp: UnsafeMutablePointer<EnergyFormatter.Unit>?) -> String

Parameters

  • numberInJoules:

    The energy value in joules.

  • 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 isForFoodEnergyUse property.

See Also

Formatting Energy Strings