// // 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]) } }