A format style that converts between decimal currency values and their textual representations.
Members (18)
get · iOS 15.0+
attributed
TypeScript
get attributed(): Decimal_FormatStyle_Attributed
Swift declaration
var attributed: Decimal.FormatStyle.Attributed { get }
An attributed format style based on the decimal currency format style.
Use this modifier to create a ``Decimal/FormatStyle/Attributed`` instance, which formats
values as ``AttributedString`` instances. These attributed strings 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.
get · iOS 15.0+
currencyCode
TypeScript
get currencyCode(): string
Swift declaration
var currencyCode: String
The currency code this format style uses, such as `USD` or `EUR`.
set · iOS 15.0+
currencyCode
TypeScript
set currencyCode(value: string)
Swift declaration
var currencyCode: String
The currency code this format style uses, such as `USD` or `EUR`.
Modifies the format style to use the specified presentation.
- Parameter p: A currency presentation value, such as
``CurrencyFormatStyleConfiguration/Presentation/isoCode`` or
``CurrencyFormatStyleConfiguration/Presentation/fullName``.
- Returns: A decimal currency format style modified to use the specified presentation.
get · iOS 15.0+
parseStrategy
TypeScript
get parseStrategy(): Decimal_ParseStrategy<Decimal_FormatStyle_Currency>
Swift declaration
var parseStrategy: Decimal.ParseStrategy<Decimal.FormatStyle.Currency> { get }
Modifies the format style to use the specified decimal separator display strategy.
- Parameter strategy: The decimal separator display strategy to apply to the format style.
- Returns: A decimal currency format style modified to use the specified decimal separator display strategy.
Creates a decimal currency format style that uses the given currency code and locale.
- Parameters:
- code: The currency code to use, such as `EUR` or `JPY`.
- locale: The locale to use when formatting or parsing decimal values.
Defaults to `Locale.autoupdatingCurrent`.
Modifies the format style to use the specified sign display strategy for displaying or omitting sign symbols.
- Parameter strategy: The sign display strategy to apply to the format style.
- Returns: A decimal currency format style modified to use the specified sign display strategy.
Modifies the format style to use the specified scale.
- Parameter multiplicand: The multiplicand to apply to the format style.
- Returns: A decimal currency format style modified to use the specified scale.
method · iOS 15.0+
format
TypeScript
format(value: Decimal): string
Swift declaration
func format(_ value: Decimal) -> String
Formats a decimal value as a currency string, using this style.
- Parameter value: The decimal value to format.
- Returns: A string representation of `value` formatted as a currency value according to the style's configuration.
get · iOS 15.0+
locale
TypeScript
get locale(): Locale
Swift declaration
var locale: Locale
The locale of the format style.
Use the ``locale(_:)`` modifier to create a copy of this format style with a different locale.
set · iOS 15.0+
locale
TypeScript
set locale(value: Locale)
Swift declaration
var locale: Locale
The locale of the format style.
Use the ``locale(_:)`` modifier to create a copy of this format style with a different locale.
Modifies the format style to use the specified locale.
- Parameter locale: The locale to apply to the format style.
- Returns: A decimal currency format style modified to use the provided locale.
Modifies the format style to use the specified rounding rule and increment.
- Parameters:
- rule: The rounding rule to apply to the format style.
- increment: A multiple by which the formatter rounds the fractional part. The formatter
produces a value that is an even multiple of this increment. If this parameter is
`nil` (the default), the formatter doesn't apply an increment.
- Returns: A decimal currency format style modified to use the specified rounding rule and increment.
Modifies the format style to use the specified grouping.
- Parameter group: The grouping to apply to the format style.
- Returns: A decimal currency format style modified to use the specified grouping.
Modifies the format style to use the specified notation.
- Parameter notation: The notation to apply to the format style.
- Returns: A decimal currency format style modified to use the specified notation.
Matches the input string within the specified bounds, beginning at the given index.
Don't call this method directly. Regular expression matching and capture calls it
automatically when matching substrings.
- Parameters:
- input: An input string to match against.
- index: The index within `input` at which to begin searching.
- bounds: The bounds within `input` in which to search.
- Returns: The upper bound where the match terminates and a matched instance, or `nil` if there isn't a match.
Modifies the format style to use the specified precision.
- Parameter p: The precision to apply to the format style.
- Returns: A decimal currency format style modified to use the specified precision.