parent
3fb273e6dd
commit
c1d716ea35
@ -0,0 +1,38 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.871",
|
||||
"green" : "0.314",
|
||||
"red" : "0.490"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.871",
|
||||
"green" : "0.314",
|
||||
"red" : "0.490"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.980",
|
||||
"green" : "0.980",
|
||||
"red" : "0.980"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.020",
|
||||
"green" : "0.020",
|
||||
"red" : "0.020"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.900",
|
||||
"green" : "0.900",
|
||||
"red" : "0.900"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.600",
|
||||
"green" : "0.600",
|
||||
"red" : "0.600"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.090",
|
||||
"green" : "0.090",
|
||||
"red" : "0.090"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.910",
|
||||
"green" : "0.910",
|
||||
"red" : "0.910"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.666",
|
||||
"green" : "0.666",
|
||||
"red" : "0.666"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.833",
|
||||
"green" : "0.833",
|
||||
"red" : "0.833"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
//
|
||||
// PodcastEpisode.swift
|
||||
// PodcastsClone
|
||||
//
|
||||
// Created by etudiant on 2023-05-21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
struct Episode {
|
||||
var id: UUID
|
||||
var publicationDate: Date
|
||||
var title: String
|
||||
var description: String
|
||||
var duration: TimeInterval // duration in seconds
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
//
|
||||
// PodcastEpisodeViewCell.swift
|
||||
// PodcastsClone
|
||||
//
|
||||
// Created by etudiant on 2023-05-12.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
|
||||
struct EpisodeViewCell: View {
|
||||
|
||||
let episode: Episode
|
||||
|
||||
private let formatter: DateFormatter = {
|
||||
// TODO display date smartly
|
||||
// TODAY
|
||||
// 1-6D AGO
|
||||
// 14 MAY (no year if same year as now)
|
||||
let formatter = DateFormatter()
|
||||
formatter.dateFormat = "dd/MM/yyyy"
|
||||
return formatter
|
||||
}()
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
// TODO make divider reach the edge on the right
|
||||
Divider()
|
||||
.foregroundColor(Color.theme.backgroundSecondary)
|
||||
|
||||
Text(formatter.string(from: episode.publicationDate))
|
||||
.font(.subheadline)
|
||||
.foregroundColor(Color.theme.secondary)
|
||||
|
||||
(Text(episode.title)
|
||||
.font(.headline)
|
||||
.foregroundColor(Color.theme.primary)
|
||||
+ Text("\n\(episode.description)")
|
||||
.font(.body)
|
||||
.foregroundColor(Color.theme.secondary))
|
||||
.lineLimit(4)
|
||||
.truncationMode(.tail)
|
||||
|
||||
HStack {
|
||||
Image(systemName: "play.fill")
|
||||
.foregroundColor(Color.theme.accent)
|
||||
.padding()
|
||||
.background(Color.theme.backgroundSecondary)
|
||||
.clipShape(Circle())
|
||||
Text(timeString(time: episode.duration))
|
||||
.foregroundColor(Color.theme.accent)
|
||||
Spacer()
|
||||
Text(Strings.threeDots)
|
||||
.foregroundColor(Color.theme.secondary)
|
||||
.padding(.horizontal)
|
||||
}
|
||||
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
|
||||
private func timeString(time: TimeInterval) -> String {
|
||||
let hours = Int(time) / 3600
|
||||
let minutes = Int(time) / 60 % 60
|
||||
|
||||
var timeComponents = [String]()
|
||||
if hours > 0 {
|
||||
timeComponents.append("\(hours) hr")
|
||||
}
|
||||
if minutes > 0 {
|
||||
timeComponents.append("\(minutes) min")
|
||||
}
|
||||
|
||||
return timeComponents.joined(separator: " ")
|
||||
}
|
||||
}
|
||||
|
||||
struct EpisodeViewCell_Previews: PreviewProvider {
|
||||
|
||||
static var previews: some View {
|
||||
EpisodeViewCell(episode: Episode(
|
||||
id: UUID(),
|
||||
publicationDate: Date.now,
|
||||
title: "Episode title and stuff -- what it's about, who's in it, all sorts of things can end up in this title. To us, it's a string",
|
||||
description: "This is a great episode. The description kinda goes on and on and on and on and on and on and on and on.",
|
||||
duration: 4000
|
||||
))
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
//
|
||||
// Color.swift
|
||||
// PodcastsClone
|
||||
//
|
||||
// Created by etudiant on 2023-05-21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
extension Color {
|
||||
static let theme = ColorTheme()
|
||||
}
|
||||
|
||||
struct ColorTheme {
|
||||
let primary = Color("primary")
|
||||
let secondary = Color("secondary")
|
||||
let background = Color("background")
|
||||
let backgroundSecondary = Color("backgroundSecondary")
|
||||
let accent = Color("accent")
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
//
|
||||
// Strings.swift
|
||||
// PodcastsClone
|
||||
//
|
||||
// Created by etudiant on 2023-05-21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
struct Strings {
|
||||
static let threeDots = "···"
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
//
|
||||
// PodcastEpisodeViewCell.swift
|
||||
// PodcastsClone
|
||||
//
|
||||
// Created by etudiant on 2023-05-12.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct PodcastEpisodeViewCell: View {
|
||||
var body: some View {
|
||||
// TODO add Divider()
|
||||
|
||||
Text("Episode Title goes here")
|
||||
// TODO add styles to episode title
|
||||
|
||||
// TODO add subtitle info incl duration - podcast title - by: podcast author - episode description
|
||||
|
||||
// TODO add play button and rounded time left (in hours, minutes...)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
struct PodcastEpisodeViewCell_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
PodcastEpisodeViewCell()
|
||||
}
|
||||
}
|
Loading…
Reference in new issue