---
title: Unit
framework: foundation
role: symbol
role_heading: Class
path: foundation/unit
---

# Unit

An abstract class representing a unit of measure.

## Declaration

```swift
class Unit
```

## Overview

Overview Each instance of an Unit subclass consists of a symbol, which can be used to create string representations of NSMeasurement objects with the MeasurementFormatter class. The Dimension 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 Dimension subclasses to represent the most common physical quantities, including mass, length, duration, and speed. Subclassing Notes Unit is intended for subclassing. For dimensional units, you should use one of the Apple provided Dimension subclasses listed in Table 1 of Dimension, or create a custom subclass of Dimension. You can create a direct subclass of Unit to represent a custom dimensionless unit, such as a count, score, or ratio.

## Topics

### Accessing Properties

- [symbol](foundation/unit/symbol.md)

### Creating Units

- [init(symbol:)](foundation/unit/init(symbol:).md)

### Initializers

- [init(coder:)](foundation/unit/init(coder:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Inherited By

- [Dimension](foundation/dimension.md)
- [UnitEnergy.EnergyKit](foundation/unitenergy/energykit.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Essentials

- [Measurement](foundation/measurement.md)
- [NSMeasurement](foundation/nsmeasurement.md)
- [Dimension](foundation/dimension.md)
