Adding/removing videos to/from playlists

This commit is contained in:
Arkadiusz Fal
2021-07-09 16:53:53 +02:00
parent 31bd2f7fe6
commit f397b13720
12 changed files with 218 additions and 17 deletions

View File

@@ -6,17 +6,20 @@ struct Playlist: Identifiable, Equatable, Hashable {
var title: String
var visibility: PlaylistVisibility
var updated: TimeInterval
var videos = [Video]()
init(_ json: JSON) {
id = json["playlistId"].stringValue
title = json["title"].stringValue
visibility = json["isListed"].boolValue ? .public : .private
updated = json["updated"].doubleValue
videos = json["videos"].arrayValue.map { Video($0) }
}
static func == (lhs: Playlist, rhs: Playlist) -> Bool {
lhs.id == rhs.id && lhs.title == rhs.title && lhs.visibility == rhs.visibility
lhs.id == rhs.id && lhs.updated == rhs.updated
}
func hash(into hasher: inout Hasher) {