In this specific case, when I try to change an @EnvironmentObject\'s @Published var, I find that the view is not invalidated and updated immediatel
A couple of things.
MasterView either.import Combine in your code (don't worry, that alone doesn't help).Here's the fix. I don't know if this is a bug, or just poor documentation - IIRC it states that objectWillChange is implicit.
Along with adding import Combine to your code, change your UserData to this:
final class UserData: NSObject, ObservableObject {
var objectWillChange = PassthroughSubject()
@Published var changeView: Bool = false {
willSet {
objectWillChange.send()
}
}
}
I tested things and it works.