Initializer

init(from:)

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

Declaration

convenience init(from energyFormatterUnit: EnergyFormatter.Unit)

Parameters

energyFormatterUnit

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

Return Value

A HealthKit unit object, or nil if the unit parameter is not a valid energy formatter unit value.

See Also

Working with Formatter Units

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

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

class func lengthFormatterUnit(from: HKUnit) -> LengthFormatter.Unit

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

init(from: LengthFormatter.Unit)

Converts a length formatter enumeration value into a corresponding HealthKit object.

class func massFormatterUnit(from: HKUnit) -> MassFormatter.Unit

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

init(from: MassFormatter.Unit)

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