mirror of
https://github.com/ivanvorobei/SwiftUI.git
synced 2026-03-28 12:12:03 +01:00
Xcode 11 beta 6
This commit is contained in:
@@ -67,6 +67,6 @@ struct VideoListView : View {
|
||||
}
|
||||
}
|
||||
}
|
||||
}.listStyle(.grouped)
|
||||
}.listStyle(GroupedListStyle())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,24 +8,24 @@
|
||||
import SwiftUI
|
||||
import Combine
|
||||
|
||||
final class UserData: BindableObject {
|
||||
let willChange = PassthroughSubject<UserData, Never>()
|
||||
final class UserData: ObservableObject {
|
||||
let objectWillChange = PassthroughSubject<UserData, Never>()
|
||||
|
||||
var showFavoriteOnly = false {
|
||||
didSet {
|
||||
willChange.send(self)
|
||||
objectWillChange.send(self)
|
||||
}
|
||||
}
|
||||
|
||||
var videos = videoList {
|
||||
didSet {
|
||||
willChange.send(self)
|
||||
objectWillChange.send(self)
|
||||
}
|
||||
}
|
||||
|
||||
var currentVideo = videoList[0] {
|
||||
didSet {
|
||||
willChange.send(self)
|
||||
objectWillChange.send(self)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,13 +32,13 @@ struct VideoRow : View {
|
||||
|
||||
Image(systemName: video.isFavorite ? "star.fill" : "star")
|
||||
.foregroundColor(video.isFavorite ? Color.yellow : Color.gray)
|
||||
.tapAction {
|
||||
.onTapGesture {
|
||||
self.setFavorite(video: self.video)
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding([.top, .bottom], 10)
|
||||
.tapAction {
|
||||
.onTapGesture {
|
||||
self.setCurrentVideo(video: self.video)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user