Instance Property

numberFormatter

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

Declaration

@NSCopying var numberFormatter: NumberFormatter! { get set }

Discussion

This property defaults to a number formatter using the NumberFormatter.Style.decimal style. You can provide a different number formatter to customize the energy string’s appearance.

See Also

Formatting Energy Strings

var isForFoodEnergyUse: Bool

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

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.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software