Compares two values after converting them to the same units.
- iOS 8.0+
- Mac Catalyst 13.0+
- watchOS 2.0+
The quantity to compare. This method throws an exception if the quantities do not have compatible units (
Returns whether the quantity argument is less than, equal to, or greater than the current quantity. This method automatically converts the quantities into the same units before comparing the values. You just need to ensure that the quantities have compatible units.
In most cases, the compatible units are clear from context. To see the unit types associated with different quantity sample types, see the type identifiers in HealthKit Constants.
If you need to programmatically check whether a particular unit is compatible with a particular quantity, call the quantity’s