Mercurial > public > lazybear
diff 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 |
line wrap: on
line diff
--- a/LazyBear/Views/Profile/Helpers/WatchlistCreatorList.swift Wed Jun 23 13:03:00 2021 +0200 +++ b/LazyBear/Views/Profile/Helpers/WatchlistCreatorList.swift Sat Jun 26 16:36:53 2021 +0200 @@ -6,7 +6,7 @@ // import SwiftUI -import Bazooka +import Alamofire struct WatchlistCreatorList: View { @ObservedObject var watchlistCreatorClass: WatchlistCreatorClass @@ -45,9 +45,10 @@ Get companies from the API that matches the searched text */ private func request(_ url: String) { - let bazooka = Bazooka() - bazooka.request(url: url, model: [SearchResponse].self) { response in - self.companies = response + AF.request(url).responseDecodable(of: [SearchResponse].self) { response in + if let value = response.value { + self.companies = value + } } }