Build Status Docs SPM Swift Version

Exchange provides exchange rates between currencies. It can also convert MonetaryAmount values into those of different Currency values.


Swift Package Manager

dependencies: [
    .package(url: "", from: "1.0.0")

Decoding a JSON response

An Exchange can be decoded directly from a the Latest Rates JSON response. See Fixer API Documentation for more information about its API usage.

Example using the Fixer Extension "YourFixerAccessKey") { result in
    switch result {
        case let .success(exchange):
            // We have an Exchange value

        case let .failure(error):
            // Something went wrong. Dig into the error.

See the documentation for Exchange.Fixer for more information.

Example using JSONDecoder Directly

let exchange = try? JSONDecoder().decode(Exchange.self, from: fixerResponseData)

Alternatively, an Exchange can be constructed with a base currency and a dictionary of currency-rate pairs.


If converting between two currencies which neither are the base currency, but each have a rate against the base currency, then a cross-rate will be produced.

For example, if the base currency is EUR but a rate for GBP to USD is requested, a cross-rate will be used. i.e. GBP to EUR to USD.

See the Collins Dictionary definition of Cross-Rate for more information.