Type Method

meterUnitWithMetricPrefix:

Returns a HealthKit unit for measuring length, using meter units with the provided prefix.

Declaration

+ (instancetype)meterUnitWithMetricPrefix:(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 length based on meters and the provided prefix.

Discussion

This method is used to create prefixed versions of meters. Common uses include creating kilometer and centimeter units, as shown below.

HKUnit *km = [HKUnit meterUnitWithMetricPrefix:HKMetricPrefixKilo];
HKUnit *cm = [HKUnit meterUnitWithMetricPrefix:HKMetricPrefixCenti];

See Also

Constructing Length Units

+ meterUnit

Returns a HealthKit unit for measuring length in meters.

+ inchUnit

Returns a HealthKit unit for measuring length in inches.

+ footUnit

Returns a HealthKit unit for measuring length in feet.

+ yardUnit

Returns a HealthKit unit for measuring length in yards.

+ mileUnit

Returns a HealthKit unit for measuring length in miles.