1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-14 22:30:32 +05:30
yattee/Model/Thumbnail.swift

22 lines
464 B
Swift
Raw Normal View History

2021-07-08 04:09:18 +05:30
import Foundation
import SwiftyJSON
struct Thumbnail {
2021-07-22 18:13:13 +05:30
enum Quality: String, CaseIterable {
case maxres, maxresdefault, sddefault, high, medium, `default`, start, middle, end
}
2021-07-08 04:09:18 +05:30
var url: URL
2021-07-22 18:13:13 +05:30
var quality: Quality
2021-07-08 04:09:18 +05:30
init(_ json: JSON) {
url = json["url"].url!
2021-07-22 18:13:13 +05:30
quality = Quality(rawValue: json["quality"].string!)!
}
init(url: URL, quality: Quality) {
self.url = url
self.quality = quality
2021-07-08 04:09:18 +05:30
}
}