Mercurial > public > lazybear
view LazyBear/Views/Company/Networking/Company.swift @ 438:7f2a24a774eb
Implement CompanyView networking
author | Dennis Concepción Martín <dennisconcepcionmartin@gmail.com> |
---|---|
date | Sun, 20 Jun 2021 13:20:19 +0200 |
parents | |
children | 01fa77358b82 |
line wrap: on
line source
// // Company.swift // LazyBear // // Created by Dennis Concepción Martín on 20/6/21. // import SwiftUI import Bazooka class Company: ObservableObject { @Published var showView = false @Published var data = CompanyResponse() func request(_ url: String, _ requestType: RequestType) { let bazooka = Bazooka() bazooka.request(url: url, model: CompanyResponse.self) { response in switch requestType { case .initial: self.data = response case .streaming: self.data.quote = response.quote case .refresh: self.data.historicalPrices = response.historicalPrices } self.showView = true } } }