@Published property wrapper in a subclass doesn’t send a callback

I worked on an app using SwiftUI and Combine framework. Then I used @Published property wrapper to publish a stream data from a property in a ViewModel class. By the way when I assign a new value to the property and it doesn’t send a callback to the counterpart SwiftUI view. Then I looked through a similar question in the stack overflow.

Then I followed the answer. But it doesn’t work in my case. So I declared objectWillChange in the subclass and now it works. I think that SwiftUI and Combine framework are not stable yet. So you might have this kind of issue.

// ViewModel 
var objectWillChange = PassthroughSubject<Void, Never>() 

var value: String = "Select" {
  willSet {

// View 
var body: some view {

Leave a Reply