Mercurial > public > lazybear
view LazyBear/Views/Profile/Networking/Profile.swift @ 374:d402bfa367c2
Implementing ProfileView
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Sat, 17 Apr 2021 00:01:59 +0200 |
parents | |
children | f3cb5bdea8e5 |
line wrap: on
line source
// // Profile.swift // LazyBear // // Created by Dennis Concepción Martín on 16/4/21. // import SwiftUI class Profile: ObservableObject { @Published var showView = false @Published var data = ProfileResponse() var streamingRequests = 0 // Count streaming requests func request(_ url: String) { genericRequest(url: url, model: ProfileResponse.self) { response in print(response) self.streamingRequests += 1 // If is the first request -> init() if self.streamingRequests == 1 { self.data = response } else { // If not, request streaming data (without intradayPrices) self.data.quotes = response.quotes } } } }