mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
26 lines
543 B
Swift
26 lines
543 B
Swift
import Alamofire
|
|
import Foundation
|
|
import SwiftyJSON
|
|
|
|
final class VideoDetailsProvider: DataProvider {
|
|
@Published var video: Video?
|
|
|
|
var id: String
|
|
|
|
init(_ id: String) {
|
|
self.id = id
|
|
super.init()
|
|
}
|
|
|
|
func load() {
|
|
DataProvider.request("videos/\(id)").responseJSON { response in
|
|
switch response.result {
|
|
case let .success(value):
|
|
self.video = Video(JSON(value))
|
|
case let .failure(error):
|
|
print(error)
|
|
}
|
|
}
|
|
}
|
|
}
|