Type Method

literUnit(with:)

Returns a HealthKit unit for measuring volume, using liter units with the provided prefix.

Declaration

class func literUnit(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 volume based on liters and the provided prefix.

Discussion

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

let ml = HKUnit.literUnitWithMetricPrefix(.Milli)
let ml = HKUnit.literUnitWithMetricPrefix(.Milli)

See Also

Constructing Volume Units

class func liter() -> Self

Returns a HealthKit unit for measuring volume in liters.

class func fluidOunceUS() -> Self

Returns a HealthKit unit for measuring volume in US fluid ounces.

class func fluidOunceImperial() -> Self

Returns a HealthKit unit for measuring volume in imperial fluid ounces.

class func cupUS() -> Self

Returns a HealthKit unit for measuring volume in US cups.

class func cupImperial() -> Self

Returns a HealthKit unit for measuring volume in imperial cups.

class func pintUS() -> Self

Returns a HealthKit unit for measuring volume in US pints.

class func pintImperial() -> Self

Returns a HealthKit unit for measuring volume in imperial pints.