yattee/Apple TV/PopularVideosView.swift

20 lines
382 B
Swift
Raw Normal View History

2021-06-28 10:43:07 +00:00
import Siesta
2021-06-11 12:36:26 +00:00
import SwiftUI
struct PopularVideosView: View {
2021-06-28 10:43:07 +00:00
@ObservedObject private var store = Store<[Video]>()
2021-06-11 21:54:00 +00:00
2021-06-28 10:43:07 +00:00
var resource = InvidiousAPI.shared.popular
2021-06-11 21:11:59 +00:00
2021-06-28 10:43:07 +00:00
init() {
resource.addObserver(store)
}
2021-06-14 18:05:02 +00:00
2021-06-28 10:43:07 +00:00
var body: some View {
VideosView(videos: store.collection)
.onAppear {
resource.loadIfNeeded()
}
2021-06-11 12:36:26 +00:00
}
}