mirror of
https://github.com/yattee/yattee.git
synced 2024-12-16 07:10:31 +05:30
19 lines
473 B
Swift
19 lines
473 B
Swift
|
import Alamofire
|
||
|
import Foundation
|
||
|
import SwiftyJSON
|
||
|
|
||
|
final class PopluarVideosProvider: DataProvider {
|
||
|
@Published var videos = [Video]()
|
||
|
|
||
|
func load() {
|
||
|
DataProvider.request("popular").responseJSON { response in
|
||
|
switch response.result {
|
||
|
case let .success(value):
|
||
|
self.videos = JSON(value).arrayValue.map { Video($0) }
|
||
|
case let .failure(error):
|
||
|
print(error)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|