2021-06-26 15:09:35 +05:30
|
|
|
import Foundation
|
|
|
|
import SwiftyJSON
|
|
|
|
|
2021-06-28 20:57:53 +05:30
|
|
|
struct Playlist: Identifiable, Equatable, Hashable {
|
2021-06-26 15:09:35 +05:30
|
|
|
let id: String
|
|
|
|
var title: String
|
|
|
|
var description: String
|
|
|
|
|
|
|
|
var videos = [Video]()
|
|
|
|
|
|
|
|
init(_ json: JSON) {
|
|
|
|
id = json["playlistId"].stringValue
|
|
|
|
title = json["title"].stringValue
|
|
|
|
description = json["description"].stringValue
|
|
|
|
videos = json["videos"].arrayValue.map { Video($0) }
|
|
|
|
}
|
|
|
|
|
|
|
|
static func == (lhs: Playlist, rhs: Playlist) -> Bool {
|
|
|
|
lhs.id == rhs.id
|
|
|
|
}
|
|
|
|
|
|
|
|
func hash(into hasher: inout Hasher) {
|
|
|
|
hasher.combine(id)
|
|
|
|
}
|
|
|
|
}
|