---
title: MassFormatter
framework: foundation
role: symbol
role_heading: Class
path: foundation/massformatter
---

# MassFormatter

A formatter that provides localized descriptions of mass and weight values.

## Declaration

```swift
class MassFormatter
```

## 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 UnitMass to provide equivalent functionality to MassFormatter. You are encouraged to transition to these new Foundation Units and Measurements APIs whenever possible.

## Topics

### Formatting Mass Strings

- [isForPersonMassUse](foundation/massformatter/isforpersonmassuse.md)
- [getObjectValue(_:for:errorDescription:)](foundation/massformatter/getobjectvalue(_:for:errordescription:).md)
- [numberFormatter](foundation/massformatter/numberformatter.md)
- [string(fromKilograms:)](foundation/massformatter/string(fromkilograms:).md)
- [string(fromValue:unit:)](foundation/massformatter/string(fromvalue:unit:).md)
- [unitString(fromKilograms:usedUnit:)](foundation/massformatter/unitstring(fromkilograms:usedunit:).md)
- [unitString(fromValue:unit:)](foundation/massformatter/unitstring(fromvalue:unit:).md)
- [unitStyle](foundation/massformatter/unitstyle.md)

### Constants

- [MassFormatter.Unit](foundation/massformatter/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

- [LengthFormatter](foundation/lengthformatter.md)
- [EnergyFormatter](foundation/energyformatter.md)
