Type Method

jouleUnitWithMetricPrefix:

Returns a HealthKit unit for measuring energy, using joule units with the provided prefix.

Declaration

+ (instancetype)jouleUnitWithMetricPrefix:(HKMetricPrefix)prefix;

Parameters

prefix

A valid metric prefix value. For the complete list of prefix values, see HKMetricPrefix.

Return Value

A HealthKit unit for measuring energy based on joules and the provided prefix.

Discussion

This method is used to create prefixed versions of joules. HealthKit commonly uses kilojoules to measure food energy in many regions. Kilojoules can be created as shown below.

HKUnit *kj = [HKUnit jouleUnitWithMetricPrefix:HKMetricPrefixKilo];

See Also

Constructing Energy Units

+ jouleUnit

Returns a HealthKit unit for measuring energy in joules.

+ calorieUnit

Returns a HealthKit unit for measuring energy in calories.

Deprecated
+ kilocalorieUnit

Returns a HealthKit unit for measuring energy in kilocalories.

+ largeCalorieUnit

Returns a HealthKit unit for measuring energy in large calories (Cal).

+ smallCalorieUnit

Returns a HealthKit unit for measuring energy in small calories (cal).