1
0
mirror of https://github.com/yattee/yattee.git synced 2025-01-06 01:20:31 +05:30
yattee/Model/StreamResolution.swift

18 lines
499 B
Swift
Raw Normal View History

2021-06-14 23:35:02 +05:30
import Foundation
enum StreamResolution: String, CaseIterable, Comparable {
2021-06-20 01:40:14 +05:30
case hd1080p, hd720p, sd480p, sd360p, sd240p, sd144p
2021-06-14 23:35:02 +05:30
var height: Int {
Int(rawValue.components(separatedBy: CharacterSet.decimalDigits.inverted).joined())!
}
static func from(resolution: String) -> StreamResolution? {
allCases.first { "\($0)".contains(resolution) }
}
static func < (lhs: StreamResolution, rhs: StreamResolution) -> Bool {
lhs.height < rhs.height
}
}