Channel playlists cache

This commit is contained in:
Arkadiusz Fal
2022-12-11 18:44:55 +01:00
parent 38593ed488
commit d4ec360581
6 changed files with 151 additions and 12 deletions

View File

@@ -40,8 +40,6 @@ struct Playlist: Identifiable, Equatable, Hashable {
}
var json: JSON {
let dateFormatter = ISO8601DateFormatter()
return [
"id": id,
"title": title,
@@ -53,8 +51,6 @@ struct Playlist: Identifiable, Equatable, Hashable {
}
static func from(_ json: JSON) -> Self {
let dateFormatter = ISO8601DateFormatter()
return .init(
id: json["id"].stringValue,
title: json["title"].stringValue,
@@ -71,4 +67,8 @@ struct Playlist: Identifiable, Equatable, Hashable {
func hash(into hasher: inout Hasher) {
hasher.combine(id)
}
var channelPlaylist: ChannelPlaylist {
ChannelPlaylist(id: id, title: title, videos: videos, videosCount: videos.count)
}
}