Views don't update with @Published data on subclasses of ObservableObject class for iOS 14

@Published var value: String = ""

Views don't update with @Published data on subclasses of ObservableObject class for iOS 14 while it works for iOS 15. I try following code as workaround:

   var value: String = "" {     willSet { objectWillChange.send() }   }

This works, but does anyone have any better suggestions?

Replies

How is your ObservableObject imported inside the view? You have to use @ObservedObject oder @StateObject for @Published to work.

https://www.hackingwithswift.com/quick-start/swiftui/all-swiftui-property-wrappers-explained-and-compared

I use @ObservedObject in the view.