💄 Create Library view

pull/1/head
Alexis Drai 2 years ago
parent 9465cf0f04
commit 328cb7f4ad

@ -10,6 +10,8 @@
EC37FB2A2A1A3231005C78D6 /* Episode.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC37FB292A1A3231005C78D6 /* Episode.swift */; };
EC37FB2C2A1A3E03005C78D6 /* Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC37FB2B2A1A3E03005C78D6 /* Color.swift */; };
EC37FB322A1A49EB005C78D6 /* Strings.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC37FB312A1A49EB005C78D6 /* Strings.swift */; };
EC48FBBA2A1A826800CD7B83 /* PodcastViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC48FBB92A1A826800CD7B83 /* PodcastViewCell.swift */; };
EC48FBBC2A1A890D00CD7B83 /* Stub.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC48FBBB2A1A890D00CD7B83 /* Stub.swift */; };
EC8CF6202A13A4F200BE6FD5 /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EC8CF61F2A13A4F200BE6FD5 /* Colors.xcassets */; };
EC8CF6232A13A59400BE6FD5 /* LibraryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC8CF6222A13A59400BE6FD5 /* LibraryView.swift */; };
EC8CF6252A13A7F000BE6FD5 /* Podcast.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC8CF6242A13A7F000BE6FD5 /* Podcast.swift */; };
@ -25,6 +27,8 @@
EC37FB292A1A3231005C78D6 /* Episode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Episode.swift; sourceTree = "<group>"; };
EC37FB2B2A1A3E03005C78D6 /* Color.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Color.swift; sourceTree = "<group>"; };
EC37FB312A1A49EB005C78D6 /* Strings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Strings.swift; sourceTree = "<group>"; };
EC48FBB92A1A826800CD7B83 /* PodcastViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PodcastViewCell.swift; sourceTree = "<group>"; };
EC48FBBB2A1A890D00CD7B83 /* Stub.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Stub.swift; sourceTree = "<group>"; };
EC8CF61F2A13A4F200BE6FD5 /* Colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Colors.xcassets; sourceTree = "<group>"; };
EC8CF6222A13A59400BE6FD5 /* LibraryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LibraryView.swift; sourceTree = "<group>"; };
EC8CF6242A13A7F000BE6FD5 /* Podcast.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Podcast.swift; sourceTree = "<group>"; };
@ -64,6 +68,39 @@
path = Strings;
sourceTree = "<group>";
};
EC48FBBD2A1A93C300CD7B83 /* Podcast */ = {
isa = PBXGroup;
children = (
ECB23BA22A0E455300A1C62B /* PodcastDetailView.swift */,
EC48FBB92A1A826800CD7B83 /* PodcastViewCell.swift */,
);
path = Podcast;
sourceTree = "<group>";
};
EC48FBBE2A1A93EB00CD7B83 /* Episode */ = {
isa = PBXGroup;
children = (
ECB23BA52A0E4C0B00A1C62B /* EpisodeViewCell.swift */,
);
path = Episode;
sourceTree = "<group>";
};
EC48FBBF2A1A93F600CD7B83 /* Library */ = {
isa = PBXGroup;
children = (
EC8CF6222A13A59400BE6FD5 /* LibraryView.swift */,
);
path = Library;
sourceTree = "<group>";
};
EC48FBC02A1A93FF00CD7B83 /* Stubs */ = {
isa = PBXGroup;
children = (
EC48FBBB2A1A890D00CD7B83 /* Stub.swift */,
);
path = Stubs;
sourceTree = "<group>";
};
EC8CF6212A13A57400BE6FD5 /* Model */ = {
isa = PBXGroup;
children = (
@ -113,12 +150,13 @@
ECB23BA42A0E45CC00A1C62B /* View */ = {
isa = PBXGroup;
children = (
EC37FB2D2A1A3FA4005C78D6 /* Extensions */,
EC37FB2E2A1A4941005C78D6 /* Strings */,
EC37FB2D2A1A3FA4005C78D6 /* Extensions */,
EC48FBC02A1A93FF00CD7B83 /* Stubs */,
EC48FBBF2A1A93F600CD7B83 /* Library */,
EC48FBBE2A1A93EB00CD7B83 /* Episode */,
EC48FBBD2A1A93C300CD7B83 /* Podcast */,
ECB23BA02A0E3FDF00A1C62B /* MainView.swift */,
ECB23BA22A0E455300A1C62B /* PodcastDetailView.swift */,
ECB23BA52A0E4C0B00A1C62B /* EpisodeViewCell.swift */,
EC8CF6222A13A59400BE6FD5 /* LibraryView.swift */,
);
path = View;
sourceTree = "<group>";
@ -195,6 +233,8 @@
buildActionMask = 2147483647;
files = (
ECB23BA12A0E3FDF00A1C62B /* MainView.swift in Sources */,
EC48FBBC2A1A890D00CD7B83 /* Stub.swift in Sources */,
EC48FBBA2A1A826800CD7B83 /* PodcastViewCell.swift in Sources */,
EC37FB322A1A49EB005C78D6 /* Strings.swift in Sources */,
EC37FB2A2A1A3231005C78D6 /* Episode.swift in Sources */,
ECB23BA62A0E4C0B00A1C62B /* EpisodeViewCell.swift in Sources */,

@ -1,17 +1,15 @@
{
"images" : [
{
"filename" : "maxfun_logo.png",
"filename" : "beefdairysquare_36.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "maxfun_logo 1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "maxfun_logo 2.png",
"idiom" : "universal",
"scale" : "3x"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "bullseye-cover2-1024x1024.jpg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "DGS-podcastArt.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "jjgo_logo.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "Screenshot 2023-05-21 at 18.58.17.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 KiB

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "oh-no-ross-and-carrie-cover-1024x1024.jpg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "spy_logo.jpg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

@ -23,9 +23,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.650",
"green" : "0.650",
"red" : "0.650"
"blue" : "0.250",
"green" : "0.250",
"red" : "0.250"
}
},
"idiom" : "universal"

@ -78,12 +78,6 @@ struct EpisodeViewCell: View {
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
))
EpisodeViewCell(episode: Stub.episodes[1])
}
}

@ -0,0 +1,49 @@
//
// LibraryView.swift
// PodcastsClone
//
// Created by etudiant on 2023-05-16.
//
import SwiftUI
struct LibraryView: View {
var podcasts: [Podcast]
var body: some View {
NavigationView {
ScrollView {
VStack(alignment: .leading) {
Text("Podcasts")
.font(.largeTitle)
.fontWeight(.bold)
.foregroundColor(Color.theme.primary)
.padding()
let columns = [
GridItem(.flexible(), spacing: 16),
GridItem(.flexible(), spacing: 16)
]
LazyVGrid(columns: columns, spacing: 16) {
ForEach(podcasts, id: \.id) { podcast in
NavigationLink(
destination: PodcastDetailView(podcast: podcast)) {
PodcastViewCell(podcast: podcast)
}
}
}
.padding(.horizontal)
}
}
}
.navigationViewStyle(StackNavigationViewStyle())
}
}
struct LibraryView_Previews: PreviewProvider {
static var previews: some View {
LibraryView(podcasts: Stub.podcasts)
}
}

@ -1,37 +0,0 @@
//
// LibraryView.swift
// PodcastsClone
//
// Created by etudiant on 2023-05-16.
//
/*
import SwiftUI
struct LibraryView: View {
// some random stuff
var podcasts =
[
Podcast(id: 0),
Podcast(id: 1),
Podcast(id: 2)
];
var body: some View {
NavigationStack{
List(podcasts, id: \.id) { currentPodcast in
//PodcastDetailView(podcast: currentPodcast)
PodcastDetailView()
}
}
}
}
struct LibraryView_Previews: PreviewProvider {
static var previews: some View {
LibraryView()
}
}
*/

@ -18,7 +18,7 @@ struct MainView: View {
.tabItem {
Label("Browse", systemImage: "square.grid.2x2")
}
Text("Library")
LibraryView(podcasts: Stub.podcasts)
.tabItem {
Label("Library", systemImage: "book")
}

@ -23,7 +23,7 @@ struct PodcastDetailView: View {
Image(uiImage: podcast.image)
.resizable()
.scaledToFit()
.cornerRadius(10)
.cornerRadius(12)
.shadow(color: Color.theme.shadow, radius: 10, x: 0, y: 10)
.padding(.horizontal, 48)
.padding(.vertical, 16)
@ -46,7 +46,8 @@ struct PodcastDetailView: View {
.foregroundColor(Color.theme.primary)
.padding(.vertical)
.padding(.horizontal, 64)
.background(Color.theme.background)
.background(Color.theme.backgroundSecondary)
.foregroundColor(Color.theme.primary)
.clipShape(RoundedRectangle(cornerSize: CGSize(width: 12.0, height: 12.0)))
// TODO replace '...' with Strings.readFurtherPrompt
@ -90,37 +91,6 @@ struct PodcastDetailView: View {
struct PodcastDetailView_Previews: PreviewProvider {
static var previews: some View {
PodcastDetailView(podcast: Podcast(
id: UUID(),
image: UIImage(named: "podcast_logo_1")!,
title: "Podcast Title 1",
by: "Author 1",
episodes: [
Episode(
id: UUID(),
publicationDate: Date.now.addingTimeInterval(-1000000),
title: "A New Ipsum",
description: "Stand in doorway, unwilling to chose whether to stay in or go out more napping, more napping all the napping is exhausting sleep i'm bored inside, let me out i'm lonely outside, let me in i can't make up my mind whether to go in or out, guess i'll just stand partway in and partway out, contemplating the universe for half an hour how dare you nudge me with your foot?!?! leap into the air in greatest offense!",
duration: 3463
),
Episode(
id: UUID(),
publicationDate: Date.now,
title: "Return of the Hooman",
description: "Catch mouse and gave it as a present mewl for food at 4am drink water out of the faucet and have secret plans. Stretch chase dog then run away. Kitty. Mouse if it fits, i sits. Bite off human's toes. If human is on laptop sit on the keyboard.",
duration: 4480
),
Episode(
id: UUID(),
publicationDate: Date.now.addingTimeInterval(-100000),
title: "Cat Ipsum Strikes Back",
description: "Chase after silly colored fish toys around the house i want to go outside let me go outside nevermind inside is better or get video posted to internet for chasing red dot eat owner's food wack the mini furry mouse so cat meoooow i iz master of hoomaan, not hoomaan master of i, oooh damn dat dog but stuff and things. Cats making all the muffins.",
duration: 4028
),
],
rating: 4.2,
reviews: 2139,
genre: "Genre 1"
))
PodcastDetailView(podcast: Stub.podcasts[0])
}
}

@ -0,0 +1,38 @@
//
// 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])
}
}

@ -0,0 +1,108 @@
//
// Stub.swift
// PodcastsClone
//
// Created by etudiant on 2023-05-21.
//
import Foundation
import SwiftUI
struct Stub {
static let episodes: [Episode] = [
Episode(
id: UUID(),
publicationDate: Date.now.addingTimeInterval(-10000000),
title: "A New Ipsum",
description: "Stand in doorway, unwilling to chose whether to stay in or go out more napping, more napping all the napping is exhausting sleep i'm bored inside, let me out i'm lonely outside, let me in i can't make up my mind whether to go in or out, guess i'll just stand partway in and partway out, contemplating the universe for half an hour how dare you nudge me with your foot?!?! leap into the air in greatest offense!",
duration: 3463
),
Episode(
id: UUID(),
publicationDate: Date.now.addingTimeInterval(-100000),
title: "Return of the Hooman",
description: "Catch mouse and gave it as a present mewl for food at 4am drink water out of the faucet and have secret plans. Stretch chase dog then run away. Kitty. Mouse if it fits, i sits. Bite off human's toes. If human is on laptop sit on the keyboard.",
duration: 4480
),
Episode(
id: UUID(),
publicationDate: Date.now.addingTimeInterval(-1000000),
title: "Cat Ipsum Strikes Back",
description: "Chase after silly colored fish toys around the house i want to go outside let me go outside nevermind inside is better or get video posted to internet for chasing red dot eat owner's food wack the mini furry mouse so cat meoooow i iz master of hoomaan, not hoomaan master of i, oooh damn dat dog but stuff and things. Cats making all the muffins.",
duration: 4028
),
]
static let podcasts: [Podcast] = [
Podcast(
id: UUID(),
image: UIImage(named: "jjho_logo")!,
title: "Podcast Title 1",
by: "Author 1",
episodes: episodes,
rating: 4.2,
reviews: 2139,
genre: "Genre 1"
),
Podcast(
id: UUID(),
image: UIImage(named: "jjgo_logo")!,
title: "Podcast Title 2",
by: "Author 2",
episodes: episodes,
rating: 4.2,
reviews: 211,
genre: "Genre 2"
),
Podcast(
id: UUID(),
image: UIImage(named: "spy_logo")!,
title: "Podcast Title 3",
by: "Author 3",
episodes: episodes,
rating: 4.812039,
reviews: 3981,
genre: "Genre 3"
),
Podcast(
id: UUID(),
image: UIImage(named: "bdnp_logo")!,
title: "Podcast Title 4",
by: "Author 4",
episodes: episodes,
rating: 4.2,
reviews: 211,
genre: "Genre 4"
),
Podcast(
id: UUID(),
image: UIImage(named: "bewjt_logo")!,
title: "Podcast Title 5",
by: "Author 5",
episodes: episodes,
rating: 4.2,
reviews: 211,
genre: "Genre 5"
),
Podcast(
id: UUID(),
image: UIImage(named: "onrac_logo")!,
title: "Podcast Title 6",
by: "Author 6",
episodes: episodes,
rating: 4.2,
reviews: 211,
genre: "Genre 6"
),
Podcast(
id: UUID(),
image: UIImage(named: "dgs_logo")!,
title: "Podcast Title 7",
by: "Author 7",
episodes: episodes,
rating: 4.2,
reviews: 211,
genre: "Genre 7"
),
]
}
Loading…
Cancel
Save