Subscriptions view

This commit is contained in:
Arkadiusz Fal
2021-06-12 00:49:42 +02:00
parent 4af395d788
commit 65e5f0f426
10 changed files with 78 additions and 60 deletions

View File

@@ -16,6 +16,10 @@ struct PopularVideosView: View {
}
var videos: [Video] {
if (provider.videos.isEmpty) {
provider.load()
}
return provider.videos
}
}

View File

@@ -0,0 +1,21 @@
import SwiftUI
struct SubscriptionsView: View {
@ObservedObject private var provider = SubscriptionVideosProvider()
@ObservedObject var state: AppState
@Binding var tabSelection: TabSelection
var body: some View {
VideosView(state: state, tabSelection: $tabSelection, videos: videos)
.task {
async {
provider.load()
}
}
}
var videos: [Video] {
return provider.videos
}
}

View File

@@ -8,7 +8,7 @@ struct VideosView: View {
var videos: [Video]
var body: some View {
Group {
Section {
List {
ForEach(videos) { video in
VideoThumbnailView(video: video)