mirror of
https://github.com/ivanvorobei/SwiftUI.git
synced 2026-05-05 07:24:05 +02:00
@Published and syntheised objectWillChange, see https://sarunw.com/posts/swiftui-changes-in-xcode-11-beta-5
This commit is contained in:
@@ -9,23 +9,9 @@ import SwiftUI
|
||||
import Combine
|
||||
|
||||
final class UserData: ObservableObject {
|
||||
let objectWillChange = PassthroughSubject<UserData, Never>()
|
||||
@Published var showFavoriteOnly = false
|
||||
|
||||
var showFavoriteOnly = false {
|
||||
didSet {
|
||||
objectWillChange.send(self)
|
||||
}
|
||||
}
|
||||
@Published var videos = videoList
|
||||
|
||||
var videos = videoList {
|
||||
didSet {
|
||||
objectWillChange.send(self)
|
||||
}
|
||||
}
|
||||
|
||||
var currentVideo = videoList[0] {
|
||||
didSet {
|
||||
objectWillChange.send(self)
|
||||
}
|
||||
}
|
||||
@Published var currentVideo = videoList[0]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user