Class

NSUnit

An abstract class representing a unit of measure.

Declaration

@interface NSUnit : NSObject

Overview

Each instance of an NSUnit subclass consists of a symbol, which can be used to create string representations of NSMeasurement objects with the NSMeasurementFormatter class.

The NSDimension subclass is an abstract class that represents a dimensional unit, which can be converted into different units of the same type. The Foundation framework provides several concrete NSDimension subclasses to represent the most common physical quantities, including mass, length, duration, and speed.

Subclassing Notes

NSUnit is intended for subclassing. For dimensional units, you should use one of the Apple provided NSDimension subclasses listed in Table 1, or create a custom subclass of NSDimension. You can create a direct subclass of NSUnit to represent a custom dimensionless unit, such as a count, score, or ratio.

Topics

Accessing Properties

symbol

The symbolic representation of the unit.

Creating Units

- initWithSymbol:

Initializes a new unit with the specified symbol.

Relationships

Inherits From

See Also

First Steps

NSMeasurement

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

NSDimension

An abstract class representing a dimensional unit of measure.