Class

LengthFormatter

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

Declaration

class LengthFormatter : Formatter

Overview

Topics

Formatting Length Strings

var isForPersonHeightUse: Bool

A Boolean value that indicates whether the resulting string represents a person’s height.

var numberFormatter: NumberFormatter!

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

func string(fromMeters: Double) -> String

Returns a length string for the provided value.

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

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

func unitString(fromValue: Double, unit: LengthFormatter.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 LengthFormatter.Unit

The units supported by the NSLengthFormatter class.

Relationships

Inherits From

Conforms To

See Also

Deprecated

class MassFormatter

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

class EnergyFormatter

A formatter that provides localized descriptions of energy values.

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