---
title: "moleUnit(withMolarMass:)"
framework: healthkit
role: symbol
role_heading: Type Method
path: "healthkit/hkunit/moleunit(withmolarmass:)"
---

# moleUnit(withMolarMass:)

Returns a HealthKit unit for measuring mass in moles for a given molar mass.

## Declaration

```swift
class func moleUnit(withMolarMass gramsPerMole: Double) -> Self
```

## Parameters

- `gramsPerMole`: The molar mass (in g/mol) of the item to be weighed.

## Return Value

Return Value A HealthKit unit for measuring the mass of an item in moles.

## Discussion

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.

## See Also

### Constructing mass units

- [gram()](healthkit/hkunit/gram().md)
- [gramUnit(with:)](healthkit/hkunit/gramunit(with:).md)
- [ounce()](healthkit/hkunit/ounce().md)
- [pound()](healthkit/hkunit/pound().md)
- [stone()](healthkit/hkunit/stone().md)
- [moleUnit(with:molarMass:)](healthkit/hkunit/moleunit(with:molarmass:).md)
- [HKUnitMolarMassBloodGlucose](healthkit/hkunitmolarmassbloodglucose.md)
