jouleUnit(with:)
Returns a HealthKit unit for measuring energy, using joule units with the provided prefix.
Declaration
class func jouleUnit(with prefix: HKMetricPrefix) -> SelfParameters
- 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.