Returns a complex unit representing the unit’s reciprocal.
SDKs
- iOS 8.0+
- Mac Catalyst 13.0+
- watchOS 2.0+
Framework
- Health
Kit
Declaration
func reciprocal() -> HKUnit
Return Value
A complex unit that is the reciprocal of the unit the method was called on.
Discussion
This method creates a new, complex unit by dividing 1 by the unit the method was called on. This is often only one step in a series of operations. For example, you can use this method to create a meters-per-second unit, as shown below.
let meters = HKUnit.meterUnit()
let seconds = HKUnit.secondUnit()
let secondsInverse = seconds.reciprocalUnit()
let metersPerSecond = meters.unitMultipliedByUnit(secondsInverse)