Instance Method

unitRaisedToPower:

Creates a complex unit by raising the unit to the given power.

Declaration

- (HKUnit *)unitRaisedToPower:(NSInteger)power;

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.

HKUnit *meters = [HKUnit meterUnit];
HKUnit *seconds = [HKUnit secondUnit];
HKUnit *squaredSeconds = [seconds unitRaisedToPower:2];
HKUnit *metersPerSecondSquared = [meters unitDividedByUnit:squaredSeconds];

See Also

Performing Unit Math

- unitMultipliedByUnit:

Creates a complex unit by multiplying the receiving unit with another unit.

- unitDividedByUnit:

Creates a complex unit by dividing the receiving unit by another unit.

- reciprocalUnit

Returns a complex unit representing the unit’s reciprocal.