---
title: EnergyFormatter
framework: foundation
role: symbol
role_heading: Class
path: foundation/energyformatter
---

# EnergyFormatter

A formatter that provides localized descriptions of energy values.

## Declaration

```swift
class EnergyFormatter
```

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

## Topics

### Formatting Energy Strings

- [isForFoodEnergyUse](foundation/energyformatter/isforfoodenergyuse.md)
- [getObjectValue(_:for:errorDescription:)](foundation/energyformatter/getobjectvalue(_:for:errordescription:).md)
- [numberFormatter](foundation/energyformatter/numberformatter.md)
- [string(fromJoules:)](foundation/energyformatter/string(fromjoules:).md)
- [string(fromValue:unit:)](foundation/energyformatter/string(fromvalue:unit:).md)
- [unitString(fromJoules:usedUnit:)](foundation/energyformatter/unitstring(fromjoules:usedunit:).md)
- [unitString(fromValue:unit:)](foundation/energyformatter/unitstring(fromvalue:unit:).md)
- [unitStyle](foundation/energyformatter/unitstyle.md)

### Constants

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