Mercurial > public > lazybear
comparison LazyBear/Views/Profile/Helpers/WatchlistCreatorList.swift @ 450:4b8031e696e8
Change Bazooka to Alamofire
Alamofire is compatible with WatchOS and MacOS
author | Dennis Concepción Martín <dennisconcepcionmartin@gmail.com> |
---|---|
date | Sat, 26 Jun 2021 16:36:53 +0200 |
parents | c78d5b5b3bda |
children |
comparison
equal
deleted
inserted
replaced
449:4255f94d0767 | 450:4b8031e696e8 |
---|---|
4 // | 4 // |
5 // Created by Dennis Concepción Martín on 2/5/21. | 5 // Created by Dennis Concepción Martín on 2/5/21. |
6 // | 6 // |
7 | 7 |
8 import SwiftUI | 8 import SwiftUI |
9 import Bazooka | 9 import Alamofire |
10 | 10 |
11 struct WatchlistCreatorList: View { | 11 struct WatchlistCreatorList: View { |
12 @ObservedObject var watchlistCreatorClass: WatchlistCreatorClass | 12 @ObservedObject var watchlistCreatorClass: WatchlistCreatorClass |
13 | 13 |
14 @State private var searchedCompany = String() | 14 @State private var searchedCompany = String() |
43 | 43 |
44 /* | 44 /* |
45 Get companies from the API that matches the searched text | 45 Get companies from the API that matches the searched text |
46 */ | 46 */ |
47 private func request(_ url: String) { | 47 private func request(_ url: String) { |
48 let bazooka = Bazooka() | 48 AF.request(url).responseDecodable(of: [SearchResponse].self) { response in |
49 bazooka.request(url: url, model: [SearchResponse].self) { response in | 49 if let value = response.value { |
50 self.companies = response | 50 self.companies = value |
51 } | |
51 } | 52 } |
52 } | 53 } |
53 | 54 |
54 /* | 55 /* |
55 1) Check if searchedCompany is empty | 56 1) Check if searchedCompany is empty |