Extended Piped support

This commit is contained in:
Arkadiusz Fal
2021-10-21 00:21:50 +02:00
parent 2d075e7b3a
commit c3326a56af
46 changed files with 706 additions and 458 deletions

View File

@@ -3,14 +3,14 @@ import Siesta
import SwiftUI
struct WatchNowSection: View {
let resource: Resource
let resource: Resource?
let label: String
@StateObject private var store = Store<[Video]>()
@EnvironmentObject<AccountsModel> private var accounts
init(resource: Resource, label: String) {
init(resource: Resource?, label: String) {
self.resource = resource
self.label = label
}
@@ -18,11 +18,11 @@ struct WatchNowSection: View {
var body: some View {
WatchNowSectionBody(label: label, videos: store.collection)
.onAppear {
resource.addObserver(store)
resource.loadIfNeeded()
resource?.addObserver(store)
resource?.loadIfNeeded()
}
.onChange(of: accounts.current) { _ in
resource.load()
resource?.load()
}
}
}