<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKUnit/moleUnit(withMolarMass:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKUnit(cm)moleUnitWithMolarMass:"
  },
  "title" : "moleUnit(withMolarMass:)"
}
-->

# moleUnit(withMolarMass:)

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

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

## Parameters

`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`](/documentation/HealthKit/HKUnitMolarMassBloodGlucose) constant to create the mole unit for blood glucose, as shown below.

```objc
HKUnit *molesOfBloodGlucose =
[HKUnit moleUnitWithMolarMass:HKUnitMolarMassBloodGlucose];
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)