Contents

energyFormatterUnit(from:)

Converts a HealthKit unit object into a corresponding energy formatter enumeration value.

Declaration

class func energyFormatterUnit(from unit: HKUnit) -> EnergyFormatter.Unit

Parameters

  • unit:

    A valid HealthKit unit object. If the unit is not an energy-type unit, this method throws an exception (Invalidargumentexception).

Return Value

An energy formatter unit value. For a list of possible energy formatter unit values, see EnergyFormatter.Unit.

See Also

Working with formatter units