Last active
January 3, 2022 23:47
-
-
Save jamesrochabrun/3e180a92d40ef092e10d7dffb0e52510 to your computer and use it in GitHub Desktop.
Itunes category identifier model.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum ItunesCategoryIdentifier: Int, CaseIterable { | |
// 1 | |
case apps | |
case podcasts | |
case tvShows | |
// 2 | |
var title: String { | |
switch self { | |
case .apps: return "Apps From the Appstore" | |
case .podcasts: return "Podcasts" | |
case .music: return "Music" | |
} | |
} | |
// 3 | |
private static let limit = 4 // the number of results that we want from each category. | |
// 4 | |
var mediaType: MediaType { | |
switch self { | |
case .apps: return .apps(contentType: .apps, chart: .topFree, limit: Self.limit, format: .json) | |
case .podcasts: return .podcasts(contentType: .episodes, chart: .top, limit: Self.limit, format: .json) | |
case .music: return .music(contentType: .albums, chart: .mostPlayed, limit: Self.limit, format: .json) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment