<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/MeasurementFormatter",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSMeasurementFormatter"
  },
  "title" : "MeasurementFormatter"
}
-->

# MeasurementFormatter

A formatter that provides localized representations of units and measurements.

```
class MeasurementFormatter
```

## Overview

You use the [`string(from:)`](/documentation/Foundation/MeasurementFormatter/string(from:)-wt9y) method to create a localized representation of an [`NSMeasurement`](/documentation/Foundation/NSMeasurement) object, and you use the [`string(from:)`](/documentation/Foundation/MeasurementFormatter/string(from:)-4hwjz) method to create a localized representation of an [`Unit`](/documentation/Foundation/Unit) object. The formatter takes into account the specified [`locale`](/documentation/Foundation/MeasurementFormatter/locale), [`unitStyle`](/documentation/Foundation/MeasurementFormatter/unitStyle), and [`unitOptions`](/documentation/Foundation/MeasurementFormatter/unitOptions-swift.property) when producing string representations of units and measurements.

> Tip:
> In Swift, you can use ``doc://com.apple.foundation/documentation/Foundation/Measurement/FormatStyle`` rather than ``doc://com.apple.foundation/documentation/Foundation/MeasurementFormatter``. The ``doc://com.apple.foundation/documentation/Foundation/FormatStyle`` API offers a declarative idiom for customizing the formatting of various types. Also, Foundation caches identical ``doc://com.apple.foundation/documentation/Foundation/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`](/documentation/Foundation/MeasurementFormatter/unitOptions-swift.property)

The options for how the unit is formatted.

[`MeasurementFormatter.UnitOptions`](/documentation/Foundation/MeasurementFormatter/UnitOptions-swift.struct)

Measurement formatter options.

[`unitStyle`](/documentation/Foundation/MeasurementFormatter/unitStyle)

The unit style.

[`locale`](/documentation/Foundation/MeasurementFormatter/locale)

The locale of the formatter.

[`numberFormatter`](/documentation/Foundation/MeasurementFormatter/numberFormatter)

The number formatter used to format the quantity of a measurement.

### Converting Measurements

[`string(from:)`](/documentation/Foundation/MeasurementFormatter/string(from:)-wt9y)

Creates and returns a localized string representation of the provided measurement.

[`string(from:)`](/documentation/Foundation/MeasurementFormatter/string(from:)-6rcb1)

Creates and returns a localized string representation of the provided measurement.

[`string(from:)`](/documentation/Foundation/MeasurementFormatter/string(from:)-4hwjz)

Creates and returns a localized string representation of the provided unit of measure.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)