yattee/Model/TrendingCategory.swift

49 lines
1.0 KiB
Swift
Raw Normal View History

import Defaults
2022-09-04 15:28:30 +00:00
import Foundation
enum TrendingCategory: String, CaseIterable, Identifiable, Defaults.Serializable {
2021-06-17 10:02:39 +00:00
case `default`, music, gaming, movies
2021-11-01 21:56:18 +00:00
var id: RawValue {
2021-06-17 10:02:39 +00:00
rawValue
}
2021-11-01 21:56:18 +00:00
var title: RawValue {
2022-09-04 15:28:30 +00:00
switch self {
case .default:
return "All".localized()
case .music:
return "Music".localized()
case .gaming:
return "Gaming".localized()
case .movies:
return "Movies".localized()
}
2021-06-17 10:02:39 +00:00
}
2021-11-01 21:56:18 +00:00
2022-12-10 01:19:36 +00:00
var systemImage: String {
switch self {
case .default:
return "chart.bar"
case .music:
return "music.note"
case .gaming:
return "gamecontroller"
case .movies:
return "film"
}
}
2021-11-01 21:56:18 +00:00
var name: String {
2022-09-04 15:28:30 +00:00
id == "default" ? "Trending".localized() : title
2021-11-01 21:56:18 +00:00
}
var controlLabel: String {
2022-09-04 15:28:30 +00:00
id == "default" ? "All".localized() : title
2021-11-01 21:56:18 +00:00
}
2023-05-26 22:24:53 +00:00
var type: String {
rawValue.capitalized
}
2021-06-17 10:02:39 +00:00
}