Minimal, idiomatic Swift client for OpenExchangeAPI
- All endpoints supported
- API key is optional
- Async/await and strong types
Add OpenExchangeApiClient.swift
to your Xcode project or Swift package.
let client = OpenExchangeApiClient(apiKey: "YOUR_API_KEY") // API key optional
let latest = try await client.getLatest(base: "EUR")
print(latest.rates["USD"] ?? 0)
let precise = try await client.getLatestPrecise(base: "EUR")
print(precise.rates["USD"] ?? "0")
getLatest(base: String?)
getLatestPrecise(base: String?)
getHistorical(date: String, base: String?)
getHistoricalPrecise(date: String, base: String?)
convert(from: String, to: String, amount: Double)
convertPrecise(from: String, to: String, amount: String)
listCurrencies(type: String?)
getCurrency(code: String)
All methods throw on error.
MIT