A formatter that provides localized representations of units and measurements.
SDKs
- iOS 10.0+
- macOS 10.12+
- Mac Catalyst 13.0+
- tvOS 10.0+
- watchOS 3.0+
Framework
- Foundation
Declaration
class MeasurementFormatter : Formatter
Overview
You use the string(from:)
method to create a localized representation of an NSMeasurement
object, and you use the string(from:)
method to create a localized representation of an Unit
object. The formatter takes into account the specified locale
, unit
, and unit
when producing string representations of units and measurements.