Mercurial > public > lazybear
comparison LazyBear/Views/Search/Networking/Search.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 | 444ec927d62f |
children |
comparison
equal
deleted
inserted
replaced
449:4255f94d0767 | 450:4b8031e696e8 |
---|---|
4 // | 4 // |
5 // Created by Dennis Concepción Martín on 16/4/21. | 5 // Created by Dennis Concepción Martín on 16/4/21. |
6 // | 6 // |
7 | 7 |
8 import SwiftUI | 8 import SwiftUI |
9 import Bazooka | 9 import Alamofire |
10 | 10 |
11 class Search: ObservableObject { | 11 class Search: ObservableObject { |
12 @Published var data = [SearchResponse()] | 12 @Published var data = [SearchResponse()] |
13 @Published var showSearchList = false | 13 @Published var showSearchList = false |
14 | 14 |
15 func request(_ url: String) { | 15 func request(_ url: String) { |
16 let bazooka = Bazooka() | 16 AF.request(url).responseDecodable(of: [SearchResponse].self) { response in |
17 bazooka.request(url: url, model: [SearchResponse].self) { response in | 17 if let value = response.value { |
18 self.data = response | 18 self.data = value |
19 self.showSearchList = true | 19 self.showSearchList = true |
20 } | |
20 } | 21 } |
21 } | 22 } |
22 } | 23 } |