| 1 | // |
| 2 | // TVContentItem.swift |
| 3 | // JomloCV tvOS Example |
| 4 | // |
| 5 | // Created by Seto Elkahfi on 2026-01-27. |
| 6 | // Copyright © 2026 Seto Elkahfi. All rights reserved. |
| 7 | // |
| 8 | |
| 9 | import JomloCollectionView |
| 10 | |
| 11 | /// A content item representing a movie or show on the big screen. |
| 12 | struct TVContentItem: JomloItem, @unchecked Sendable { |
| 13 | let id: String |
| 14 | let title: String |
| 15 | let subtitle: String |
| 16 | let colorHex: String |
| 17 | let isFeatured: Bool |
| 18 | |
| 19 | nonisolated var itemIdentifier: String { id } |
| 20 | |
| 21 | nonisolated static func == (lhs: TVContentItem, rhs: TVContentItem) -> Bool { |
| 22 | lhs.id == rhs.id |
| 23 | } |
| 24 | |
| 25 | nonisolated func hash(into hasher: inout Hasher) { |
| 26 | hasher.combine(id) |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | /// A hero/featured item with richer metadata for the top-shelf style display. |
| 31 | struct TVHeroItem: JomloItem, @unchecked Sendable { |
| 32 | let id: String |
| 33 | let title: String |
| 34 | let tagline: String |
| 35 | let metadata: String |
| 36 | let gradientTop: String |
| 37 | let gradientBottom: String |
| 38 | |
| 39 | nonisolated var itemIdentifier: String { id } |
| 40 | |
| 41 | nonisolated static func == (lhs: TVHeroItem, rhs: TVHeroItem) -> Bool { |
| 42 | lhs.id == rhs.id |
| 43 | } |
| 44 | |
| 45 | nonisolated func hash(into hasher: inout Hasher) { |
| 46 | hasher.combine(id) |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | /// A category/channel item for the grid navigation. |
| 51 | struct TVCategoryItem: JomloItem, @unchecked Sendable { |
| 52 | let id: String |
| 53 | let name: String |
| 54 | let icon: String |
| 55 | let colorHex: String |
| 56 | |
| 57 | nonisolated var itemIdentifier: String { id } |
| 58 | |
| 59 | nonisolated static func == (lhs: TVCategoryItem, rhs: TVCategoryItem) -> Bool { |
| 60 | lhs.id == rhs.id |
| 61 | } |
| 62 | |
| 63 | nonisolated func hash(into hasher: inout Hasher) { |
| 64 | hasher.combine(id) |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | /// A sentinel item that renders as the "See All" card at the end of a shelf. |
| 69 | /// Tapping it (or pressing select on the Siri Remote) pushes the full grid page. |
| 70 | struct TVSeeAllItem: JomloItem, @unchecked Sendable { |
| 71 | let id: String |
| 72 | let sectionTitle: String |
| 73 | |
| 74 | nonisolated var itemIdentifier: String { id } |
| 75 | |
| 76 | nonisolated static func == (lhs: TVSeeAllItem, rhs: TVSeeAllItem) -> Bool { |
| 77 | lhs.id == rhs.id |
| 78 | } |
| 79 | |
| 80 | nonisolated func hash(into hasher: inout Hasher) { |
| 81 | hasher.combine(id) |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | /// A "continue watching" item with progress state. |
| 86 | struct TVResumeItem: JomloItem, @unchecked Sendable { |
| 87 | let id: String |
| 88 | let title: String |
| 89 | let episodeInfo: String |
| 90 | let progress: Float |
| 91 | let colorHex: String |
| 92 | let remainingTime: String |
| 93 | |
| 94 | nonisolated var itemIdentifier: String { id } |
| 95 | |
| 96 | nonisolated static func == (lhs: TVResumeItem, rhs: TVResumeItem) -> Bool { |
| 97 | lhs.id == rhs.id |
| 98 | } |
| 99 | |
| 100 | nonisolated func hash(into hasher: inout Hasher) { |
| 101 | hasher.combine(id) |
| 102 | } |
| 103 | } |