---
title: "meterUnit(with:)"
framework: healthkit
role: symbol
role_heading: Type Method
path: "healthkit/hkunit/meterunit(with:)"
---

# meterUnit(with:)

Returns a HealthKit unit for measuring length, using meter units with the provided prefix.

## Declaration

```swift
class func meterUnit(with prefix: HKMetricPrefix) -> Self
```

## Parameters

- `prefix`: A valid metric prefix value. For the complete list of prefix values, see doc://com.apple.healthkit/documentation/HealthKit/HKMetricPrefix.

## Return Value

Return Value A HealthKit unit for measuring length based on meters and the provided prefix.

## Discussion

Discussion This method is used to create prefixed versions of meters. Common uses include creating kilometer and centimeter units, as shown below.

## See Also

### Constructing length units

- [meter()](healthkit/hkunit/meter().md)
- [inch()](healthkit/hkunit/inch().md)
- [foot()](healthkit/hkunit/foot().md)
- [yard()](healthkit/hkunit/yard().md)
- [mile()](healthkit/hkunit/mile().md)
