yattee/Model/TrendingCountriesProvider.swift

19 lines
369 B
Swift
Raw Normal View History

2021-06-17 10:02:39 +00:00
import Alamofire
import Foundation
import SwiftyJSON
final class TrendingCountriesProvider: DataProvider {
@Published var countries = [Country]()
private var query: String = ""
func load(_ query: String) {
guard query != self.query else {
return
}
self.query = query
2021-06-17 22:43:29 +00:00
countries = Country.search(query)
2021-06-17 10:02:39 +00:00
}
}