diff --git a/Apple TV/VideoThumbnailView.swift b/Apple TV/VideoThumbnailView.swift index 5f5c6ad6..255fc6e3 100644 --- a/Apple TV/VideoThumbnailView.swift +++ b/Apple TV/VideoThumbnailView.swift @@ -42,8 +42,10 @@ struct VideoThumbnailView: View { Image(systemName: "calendar") Text(video.published) - Image(systemName: "eye") - Text(video.viewsCount) + if video.views != 0 { + Image(systemName: "eye") + Text(video.viewsCount) + } } .foregroundColor(.secondary) .padding(.top) @@ -53,10 +55,12 @@ struct VideoThumbnailView: View { Spacer() HStack(spacing: 8) { - Image(systemName: "clock") + if let time = video.playTime { + Image(systemName: "clock") - Text(video.playTime ?? "-") - .fontWeight(.bold) + Text(time) + .fontWeight(.bold) + } } .foregroundColor(.secondary) } diff --git a/Model/Video.swift b/Model/Video.swift index 86a0a5db..5681b4b1 100644 --- a/Model/Video.swift +++ b/Model/Video.swift @@ -50,6 +50,10 @@ final class Video: Identifiable, ObservableObject { } var playTime: String? { + guard !length.isZero else { + return nil + } + let formatter = DateComponentsFormatter() formatter.unitsStyle = .positional