energyFormatterUnit(from:)
Converts a HealthKit unit object into a corresponding energy formatter enumeration value.
Declaration
class func energyFormatterUnit(from unit: HKUnit) -> EnergyFormatter.UnitParameters
- 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.