Last active
December 24, 2021 09:14
-
-
Save erdemildiz/e1a260197598c1a2484e7a142dbaaaa9 to your computer and use it in GitHub Desktop.
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
// | |
// CurrencyListModel.swift | |
// socket-demo | |
// | |
// Created by Erdem ILDIZ | |
// | |
import Foundation | |
// MARK: - CurrencyList | |
struct CurrencyList: Codable { | |
let data: [CurrencyItem] | |
} | |
// MARK: - CurrencyItem | |
struct CurrencyItem: Codable { | |
let id: Int | |
let name, symbol, slug: String | |
let lastUpdated: String | |
let quote: Quote | |
enum CodingKeys: String, CodingKey { | |
case id, name, symbol, slug | |
case lastUpdated = "last_updated" | |
case quote | |
} | |
} | |
// MARK: - Quote | |
struct Quote: Codable { | |
let price: Price | |
enum CodingKeys: String, CodingKey { | |
case price = "USD" | |
} | |
} | |
// MARK: - Price | |
struct Price: Codable { | |
let priceValue, volume24H : Double | |
let lastUpdated: String | |
enum CodingKeys: String, CodingKey { | |
case priceValue = "price" | |
case volume24H = "volume_24h" | |
case lastUpdated = "last_updated" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment