Mercurial > public > lazybear
diff LazyBear/Views/Home/Networking/Home.swift @ 401:f843c6382529
Add Enumeration to Networks files
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Thu, 20 May 2021 21:04:49 +0200 |
parents | 6303385b3629 |
children | 444ec927d62f |
line wrap: on
line diff
--- a/LazyBear/Views/Home/Networking/Home.swift Sat May 15 19:54:20 2021 +0200 +++ b/LazyBear/Views/Home/Networking/Home.swift Thu May 20 21:04:49 2021 +0200 @@ -11,17 +11,16 @@ @Published var showView = false @Published var data = HomeResponse() - func request(_ url: String, isInitRequest: Bool) { + func request(_ url: String, _ requestType: RequestType) { genericRequest(url: url, model: HomeResponse.self) { response in - - // If is the first request -> init() - if isInitRequest { + switch requestType { + case .initial: self.data = response - } else { - // If not, request streaming data (without intradayPrices and latestCurrencies) + default: self.data.lists = response.lists self.data.sectorPerformance = response.sectorPerformance } + self.showView = true } }