moleUnit(withMolarMass:)
Returns a HealthKit unit for measuring mass in moles for a given molar mass.
Declaration
class func moleUnit(withMolarMass gramsPerMole: Double) -> SelfParameters
- gramsPerMole:
The molar mass (in g/mol) of the item to be weighed.
Return Value
A HealthKit unit for measuring the mass of an item in moles.
Discussion
To create a unit for measuring an item in moles, you need to know that item’s molar mass. For example, you can use the HKUnitMolarMassBloodGlucose constant to create the mole unit for blood glucose, as shown below.