A numeric quantity labeled with a unit of measure, with support for unit conversion and unit-aware calculations.


@interface NSMeasurement<__covariant UnitType> : NSObject


An NSMeasurement object represents a quantity and unit of measure. The NSMeasurement class provides a programmatic interface to converting measurements into different units, as well as calculating the sum or difference between two measurements.

NSMeasurement objects are initialized with an NSUnit object and double value. NSMeasurement objects are immutable, and cannot be changed after being created.

You can use the NSMeasurementFormatter class to create localized string representations of NSMeasurement objects.


Creating Measurements

- initWithDoubleValue:unit:

Initializes a new measurement with a specified double-precision floating-point value and unit.

Accessing Unit and Value


The unit of measure.


The measurement value, represented as a double-precision floating-point number.

Converting to Other Units

- canBeConvertedToUnit:

Indicates whether the measurement can be converted to the given unit.

- measurementByConvertingToUnit:

Returns a measurement created by converting the receiver to the specified unit.

Operating on Measurements

- measurementByAddingMeasurement:

Returns a new measurement by adding the receiver to the specified measurement.

- measurementBySubtractingMeasurement:

Returns a new measurement by subtracting the specified measurement from the receiver.


Inherits From

See Also

First Steps


An abstract class representing a unit of measure.


An abstract class representing a dimensional unit of measure.