---
title: LengthFormatter
framework: foundation
role: symbol
role_heading: Class
path: foundation/lengthformatter
---

# LengthFormatter

A formatter that provides localized descriptions of linear distances, such as length and height measurements.

## Declaration

```swift
class LengthFormatter
```

## Overview

Overview note: As of iOS 10, macOS 10.12, tvOS 10, and watchOS 3, Foundation provides the MeasurementFormatter class, which can be used to represent quantities of UnitLength to provide equivalent functionality to LengthFormatter. You are encouraged to transition to these new Foundation Units and Measurements APIs whenever possible.

## Topics

### Formatting Length Strings

- [isForPersonHeightUse](foundation/lengthformatter/isforpersonheightuse.md)
- [getObjectValue(_:for:errorDescription:)](foundation/lengthformatter/getobjectvalue(_:for:errordescription:).md)
- [numberFormatter](foundation/lengthformatter/numberformatter.md)
- [string(fromMeters:)](foundation/lengthformatter/string(frommeters:).md)
- [string(fromValue:unit:)](foundation/lengthformatter/string(fromvalue:unit:).md)
- [unitString(fromMeters:usedUnit:)](foundation/lengthformatter/unitstring(frommeters:usedunit:).md)
- [unitString(fromValue:unit:)](foundation/lengthformatter/unitstring(fromvalue:unit:).md)
- [unitStyle](foundation/lengthformatter/unitstyle.md)

### Constants

- [LengthFormatter.Unit](foundation/lengthformatter/unit.md)

## Relationships

### Inherits From

- [Formatter](foundation/formatter.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)

## See Also

### Deprecated

- [MassFormatter](foundation/massformatter.md)
- [EnergyFormatter](foundation/energyformatter.md)
