Contents

gramUnit(with:)

Returns a HealthKit unit for measuring mass, using gram units with the provided prefix.

Declaration

class func gramUnit(with prefix: HKMetricPrefix) -> Self

Parameters

  • prefix:

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

Return Value

A HealthKit unit for measuring mass based on grams and the given prefix.

Discussion

This method is used to create prefixed versions of grams, typically kilogram units, as shown below.

See Also

Constructing mass units