---
title: UnitConverter
framework: foundation
role: symbol
role_heading: Class
path: foundation/unitconverter
---

# UnitConverter

An abstract class that provides a description of how to convert a unit to and from the base unit of its dimension.

## Declaration

```swift
class UnitConverter
```

## Overview

Overview For units that can be converted by a scale factor or linear equation, use the concrete subclass UnitConverterLinear. Subclassing Notes UnitConverter is an abstract class that is intended for subclassing. You can implement your own subclass of UnitConverter to convert between units according to any desired mapping function. For example, units may be converted using a logarithmic, exponential, or quantile scale. Methods to Override All subclasses must fully implement the following methods: baseUnitValue(fromValue:) value(fromBaseUnitValue:) Alternatives to Subclassing As stated above, most physical units can be converted using a linear equation with UnitConverterLinear. You should only create a custom subclass of UnitConverter for units that cannot be converted in this way.

## Topics

### Converting Between Units

- [baseUnitValue(fromValue:)](foundation/unitconverter/baseunitvalue(fromvalue:).md)
- [value(fromBaseUnitValue:)](foundation/unitconverter/value(frombaseunitvalue:).md)

## Relationships

### Inherits From

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

### Inherited By

- [UnitConverterLinear](foundation/unitconverterlinear.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Conversion

- [UnitConverterLinear](foundation/unitconverterlinear.md)
