Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class StockListViewModel {
- var stocks = [StockViewModel]()
- func fetchAllStocks() {
- HTTPClient().getAllStocks(urlString: "https://silicon-rhinoceros.glitch.me/stocks") { result in
- DispatchQueue.main.async {
- switch result {
- case .success(let stocks):
- self.stocks = stocks.map(StockViewModel.init)
- case .failure(let error):
- print(error.localizedDescription)
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement