-
-
Save TyrfingMjolnir/34d905c973efe5fbe72374cd059972d0 to your computer and use it in GitHub Desktop.
Currency Result
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct CurrencyResult: Codable { | |
| let success: Bool | |
| let name: String | |
| let date: String | |
| let rawCurrencies: [String: Float] | |
| var currencies: [Currency] { | |
| var currencies = [Currency]() | |
| for (uid, rate) in rawCurrencies { | |
| let currency = Currency(uid: uid, rate: rate) | |
| currencies.append(currency) | |
| } | |
| return currencies | |
| } | |
| private enum CodingKeys: String, CodingKey { | |
| case success | |
| case date | |
| case rawCurrencies = "rates" | |
| case name = "base" | |
| } | |
| } | |
| struct Currency: Codable { | |
| let uid: String | |
| let rate: Float | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment