---
title: MeasurementFormatter
framework: foundation
role: symbol
role_heading: Class
path: foundation/measurementformatter
---

# MeasurementFormatter

A formatter that provides localized representations of units and measurements.

## Declaration

```swift
class MeasurementFormatter
```

## Overview

Overview You use the string(from:) method to create a localized representation of an NSMeasurement object, and you use the string(from:) method to create a localized representation of an Unit object. The formatter takes into account the specified locale, unitStyle, and unitOptions when producing string representations of units and measurements. tip: In Swift, you can use Measurement.FormatStyle rather than MeasurementFormatter. The FormatStyle API offers a declarative idiom for customizing the formatting of various types. Also, Foundation caches identical FormatStyle instances, so you don’t need to pass them around your app, or risk wasting memory with duplicate formatters.

## Topics

### Specifying the Format

- [unitOptions](foundation/measurementformatter/unitoptions-swift.property.md)
- [MeasurementFormatter.UnitOptions](foundation/measurementformatter/unitoptions-swift.struct.md)
- [unitStyle](foundation/measurementformatter/unitstyle.md)
- [locale](foundation/measurementformatter/locale.md)
- [numberFormatter](foundation/measurementformatter/numberformatter.md)

### Converting Measurements

- [string(from:)](foundation/measurementformatter/string(from:)-wt9y.md)
- [string(from:)](foundation/measurementformatter/string(from:)-6rcb1.md)
- [string(from:)](foundation/measurementformatter/string(from:)-4hwjz.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)
- [NSSecureCoding](foundation/nssecurecoding.md)
