Editing playlists

This commit is contained in:
Arkadiusz Fal
2021-07-08 19:18:36 +02:00
parent 88a733da34
commit 31bd2f7fe6
9 changed files with 255 additions and 132 deletions

View File

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