yattee/Shared/Views/PopularView.swift

24 lines
500 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
2021-07-27 22:40:04 +00:00
struct PopularView: View {
2021-09-25 08:18:22 +00:00
@StateObject private var store = Store<[Video]>()
2021-06-11 21:54:00 +00:00
2021-09-25 08:18:22 +00:00
@EnvironmentObject<InvidiousAPI> private var api
2021-06-11 21:11:59 +00:00
2021-09-25 08:18:22 +00:00
var resource: Resource {
api.popular
2021-06-28 10:43:07 +00:00
}
2021-06-14 18:05:02 +00:00
2021-06-28 10:43:07 +00:00
var body: some View {
VideosView(videos: store.collection)
2021-09-25 08:18:22 +00:00
.onAppear {
resource.addObserver(store)
resource.loadIfNeeded()
}
2021-07-11 20:52:49 +00:00
#if !os(tvOS)
.navigationTitle("Popular")
#endif
2021-06-11 12:36:26 +00:00
}
}