Creates a complex unit by raising the unit to the given power.
SDKs
- iOS 8.0+
- Mac Catalyst 13.0+
- watchOS 2.0+
Framework
- Health
Kit
Declaration
Parameters
power
The power by which to raise the unit.
Return Value
A new, complex unit.
Discussion
This method creates a new, complex unit by raising the unit this method is called on by the given power. This task is often only one step in a series of operations. For example, you can use this method to create a meters-per-second-squared unit as shown below.
let meters = HKUnit.meterUnit()
let seconds = HKUnit.secondUnit()
let squaredSeconds = seconds.unitRaisedToPower(2)
let metersPerSecondSquared = meters.unitDividedByUnit(squaredSeconds)