---
title: "is(compatibleWith:)"
framework: healthkit
role: symbol
role_heading: Instance Method
path: "healthkit/hkquantity/is(compatiblewith:)"
---

# is(compatibleWith:)

Returns a boolean value indicating whether the quantity is compatible with the provided unit.

## Declaration

```swift
func `is`(compatibleWith unit: HKUnit) -> Bool
```

## Parameters

- `unit`: The target unit.

## Return Value

Return Value Yes if the quantity is compatible; otherwise, false.

## Discussion

Discussion Individual units are compatible if they measure the same feature. For example, all length units are compatible. All mass units are also compatible. However, a length unit is not compatible with a mass unit. Complex units are compatible if the equation defining the units are compatible. Specifically, it must use the same operators, and the operands must be compatible. For example, meters per second and miles per hour are compatible. The left operands are both length units, the right operands are both time units and they all use a division operator.

## See Also

### Working With Units

- [doubleValue(for:)](healthkit/hkquantity/doublevalue(for:).md)
