<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/FormatStyle/currency(code:)-is0v",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation11FormatStylePAAE8currency4codeAA07IntegerbC0V8CurrencyVyqd___GSS_tAJRszSzRd__lFZ"
  },
  "title" : "currency(code:)"
}
-->

# currency(code:)

Returns a format style to use integer currency notation.

```
static func currency<V>(code: String) -> Self where Self == IntegerFormatStyle<V>.Currency, V : BinaryInteger
```

## Parameters

`code`

The currency code to use, such as `EUR` or `JPY`. See ISO-4217 for a list of valid codes.

## Return Value

An integer format style that uses the specified currency code.

## Discussion

Use the dot-notation form of this method when the call point allows the use of [`IntegerFormatStyle`](/documentation/Foundation/IntegerFormatStyle). You typically do this when calling the `formatted` methods of types that conform to <doc://com.apple.documentation/documentation/Swift/BinaryInteger>.

The following example creates an array of integers, then uses <doc://com.apple.documentation/documentation/Swift/BinaryInteger/formatted(_:)-73k3e> and the currency style provided by this method to format the integers as US dollars:

```swift
let nums: [Int] = [100, 1000, 10000, 100000, 1000000]
let currencyNums = nums.map { $0.formatted(
    .currency(code:"USD")) } // ["$100.00", "$1,000.00", "$10,000.00", "$100,000.00", "$1,000,000.00"]
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)