One Logo Pool Ball
Foundation · IOS API REFERENCE

Decimal.FormatStyle.Currency

struct · iOS 15.0+ · SDK 27.1

struct Currency

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`.

method · iOS 15.0+

presentation

TypeScript
presentation(p: CurrencyFormatStyleConfiguration_Presentation): Decimal_FormatStyle_Currency
Swift declaration
func presentation(_ p: Decimal.FormatStyle.Currency.Configuration.Presentation) -> Decimal.FormatStyle.Currency

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 }

The parse strategy that this format style uses.

method · iOS 15.0+

decimalSeparator

TypeScript
decimalSeparator(strategy: NumberFormatStyleConfiguration_DecimalSeparatorDisplayStrategy): Decimal_FormatStyle_Currency
Swift declaration
func decimalSeparator(strategy: Decimal.FormatStyle.Currency.Configuration.DecimalSeparatorDisplayStrategy) -> Decimal.FormatStyle.Currency

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.

init · iOS 15.0+

init

TypeScript
static init(code: string, locale?: Locale): Decimal_FormatStyle_Currency
Swift declaration
init(code: String, locale: Locale = .autoupdatingCurrent)

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`.

method · iOS 15.0+

sign

TypeScript
sign(strategy: CurrencyFormatStyleConfiguration_SignDisplayStrategy): Decimal_FormatStyle_Currency
Swift declaration
func sign(strategy: Decimal.FormatStyle.Currency.Configuration.SignDisplayStrategy) -> Decimal.FormatStyle.Currency

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.

method · iOS 15.0+

scale

TypeScript
scale(multiplicand: number): Decimal_FormatStyle_Currency
Swift declaration
func scale(_ multiplicand: Double) -> Decimal.FormatStyle.Currency

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.

method · iOS 15.0+

locale

TypeScript
locale50868(locale: Locale): Decimal_FormatStyle_Currency
Swift declaration
func locale(_ locale: Locale) -> Decimal.FormatStyle.Currency

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.

method · iOS 15.0+

rounded

TypeScript
rounded(rule?: SDKHandle, increment?: (number) | null): Decimal_FormatStyle_Currency
Swift declaration
func rounded(rule: Decimal.FormatStyle.Currency.Configuration.RoundingRule = .toNearestOrEven, increment: Int? = nil) -> Decimal.FormatStyle.Currency

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.

method · iOS 15.0+

grouping

TypeScript
grouping(group: NumberFormatStyleConfiguration_Grouping): Decimal_FormatStyle_Currency
Swift declaration
func grouping(_ group: Decimal.FormatStyle.Currency.Configuration.Grouping) -> Decimal.FormatStyle.Currency

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.

method · iOS 18.0+

notation

TypeScript
notation(notation: NumberFormatStyleConfiguration_Notation): Decimal_FormatStyle_Currency
Swift declaration
func notation(_ notation: Decimal.FormatStyle.Currency.Configuration.Notation) -> Decimal.FormatStyle.Currency

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.

method · iOS 16.0+

consuming

TypeScript
consuming(input: string, index: SDKHandle, bounds: SDKHandle): ({ "upperBound": SDKHandle; "output": Decimal }) | null
Swift declaration
func consuming(_ input: String, startingAt index: String.Index, in bounds: Range<String.Index>) throws -> (upperBound: String.Index, output: Decimal)?

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.

method · iOS 15.0+

precision

TypeScript
precision(p: NumberFormatStyleConfiguration_Precision): Decimal_FormatStyle_Currency
Swift declaration
func precision(_ p: Decimal.FormatStyle.Currency.Configuration.Precision) -> Decimal.FormatStyle.Currency

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.

Skipped declarations

No declarations were skipped in this snapshot.

All Foundation types →