Skip to content

Instantly share code, notes, and snippets.

@erdemildiz
Last active December 24, 2021 09:14
Show Gist options
  • Save erdemildiz/e1a260197598c1a2484e7a142dbaaaa9 to your computer and use it in GitHub Desktop.
Save erdemildiz/e1a260197598c1a2484e7a142dbaaaa9 to your computer and use it in GitHub Desktop.
//
// 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