A format style that converts decimal values into attributed strings.
Use the ``Decimal/FormatStyle/attributed`` modifier on a ``Decimal/FormatStyle`` to create
a format style of this type.
The attributed strings that this format style creates contain attributes from the
``AttributeScopes/FoundationAttributes/NumberFormatAttributes`` attribute scope. Use these
attributes to determine which runs of the attributed string represent different parts of
the formatted value.
Members (2)
method · iOS 15.0+
format
TypeScript
format(value: Decimal): AttributedString
Swift declaration
func format(_ value: Decimal) -> AttributedString
Formats a decimal value, using this style.
- Parameter value: The decimal value to format.
- Returns: An attributed string representation of `value`, formatted according to the
style's configuration. The returned string contains attributes from the
``AttributeScopes/FoundationAttributes/NumberFormatAttributes`` attribute scope to
indicate runs formatted by this format style.
Modifies the format style to use the specified locale.
- Parameter locale: The locale to apply to the format style.
- Returns: A format style that uses the specified locale.