Mercurial > public > lazybear
comparison LazyBear/Views/Home/Networking/HomeResponse.swift @ 375:f3cb5bdea8e5
Update Codable requests in HomeView
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Wed, 21 Apr 2021 16:19:50 +0200 |
parents | 5ccceb527178 |
children | 9b7af8e83d12 |
comparison
equal
deleted
inserted
replaced
374:d402bfa367c2 | 375:f3cb5bdea8e5 |
---|---|
6 // | 6 // |
7 | 7 |
8 import SwiftUI | 8 import SwiftUI |
9 | 9 |
10 struct HomeResponse: Codable { | 10 struct HomeResponse: Codable { |
11 var lists: [String: [QuoteModel]]? // String is the list type; gainers, losers ... | 11 var intradayPrices: [String: [IntradayPriceModel]]? |
12 var sectorPerformance: [SectorPerformanceModel]? | 12 var latestCurrencies: [String: CurrencyModel]? |
13 var tradingDates: [TradingDatesModel]? | 13 var lists: ListsModel? |
14 var intradayPrices: [String: NestedIntradayPricesModel]? // String is each company symbol | 14 var sectorPerformance: [SectorPerformanceModel]? |
15 var latestCurrencies: [String: CurrencyModel]? | 15 var tradingDates: [TradingDatesModel]? |
16 | 16 |
17 private enum CodingKeys : String, CodingKey { | 17 private enum CodingKeys : String, CodingKey { |
18 case intradayPrices = "intraday_prices" | |
19 case latestCurrencies = "latest_currencies" | |
18 case lists | 20 case lists |
19 case sectorPerformance = "sector_performance" | 21 case sectorPerformance = "sector_performance" |
20 case tradingDates = "trading_dates" | 22 case tradingDates = "trading_dates" |
21 case intradayPrices = "intraday_prices" | |
22 case latestCurrencies = "latest_currencies" | |
23 } | 23 } |
24 } | 24 } |
25 | 25 |
26 | 26 |
27 struct NestedIntradayPricesModel: Codable { | 27 struct ListsModel: Codable { |
28 var nestedIntradayPrices: [IntradayPricesModel] | 28 var mostactive: [String: QuoteModel]? |
29 | 29 var gainers: [String: QuoteModel]? |
30 private enum CodingKeys : String, CodingKey { | 30 var losers: [String: QuoteModel]? |
31 case nestedIntradayPrices = "intradayprices" | |
32 } | |
33 } | 31 } |