mirror of
https://github.com/yattee/yattee.git
synced 2024-09-19 17:01:32 +00:00
28 lines
580 B
Swift
28 lines
580 B
Swift
|
import Siesta
|
||
|
import SwiftUI
|
||
|
|
||
|
struct ChannelVideosView: View {
|
||
|
@ObservedObject private var store = Store<[Video]>()
|
||
|
|
||
|
let channel: Channel
|
||
|
|
||
|
var resource: Resource {
|
||
|
InvidiousAPI.shared.channelVideos(channel.id)
|
||
|
}
|
||
|
|
||
|
init(_ channel: Channel) {
|
||
|
self.channel = channel
|
||
|
resource.addObserver(store)
|
||
|
}
|
||
|
|
||
|
var body: some View {
|
||
|
VideosView(videos: store.collection)
|
||
|
#if !os(tvOS)
|
||
|
.navigationTitle("\(channel.name) Channel")
|
||
|
#endif
|
||
|
.onAppear {
|
||
|
resource.loadIfNeeded()
|
||
|
}
|
||
|
}
|
||
|
}
|