You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
992 B
39 lines
992 B
//
|
|
// PodcastViewCell.swift
|
|
// PodcastsClone
|
|
//
|
|
// Created by etudiant on 2023-05-21.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct PodcastViewCell: View {
|
|
let podcast: Podcast
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading) {
|
|
Image(uiImage: podcast.image)
|
|
.resizable()
|
|
.scaledToFit()
|
|
.cornerRadius(12)
|
|
|
|
Text(podcast.title)
|
|
.foregroundColor(Color.theme.primary)
|
|
|
|
// TODO display relative date more smartly
|
|
// TODAY
|
|
// 1-6D AGO
|
|
// 14 MAY (no year if same year as now)
|
|
Text("Updated \(podcast.episodes.first?.publicationDate ?? Date(), style: .relative) ago")
|
|
.foregroundColor(Color.theme.secondary)
|
|
.font(.footnote)
|
|
}
|
|
}
|
|
}
|
|
|
|
struct PodcastViewCell_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
PodcastViewCell(podcast: Stub.podcasts[0])
|
|
}
|
|
}
|