Class

EnergyFormatter

A formatter that provides localized descriptions of energy values.

Declaration

class EnergyFormatter : Formatter

Overview

Topics

Formatting Energy Strings

var isForFoodEnergyUse: Bool

A Boolean value that indicates whether the energy value is used to measure food energy.

var numberFormatter: NumberFormatter!

The number formatter used to format the numbers in energy strings.

func string(fromJoules: Double) -> String

Returns an energy string for the provided value.

func string(fromValue: Double, unit: EnergyFormatter.Unit) -> String

Returns a properly formatted energy string for the given value and unit.

func unitString(fromValue: Double, unit: EnergyFormatter.Unit) -> String

Returns the unit string based on the provided value and unit.

var unitStyle: Formatter.UnitStyle

The unit style used by this formatter.

Constants

enum EnergyFormatter.Unit

The units supported by the NSEnergyFormatter class.

Relationships

Inherits From

Conforms To

See Also

Deprecated

class LengthFormatter

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

class MassFormatter

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