Swift UI Text view of interpolated string with observed object state not updating

I have a view with a couple of subviews whose text is created using string interpolation with fields and function results from an observed object.

For example,
Code Block
Button("\(self.obj.get_value(self.obj.selection))") {
self.obj.make_a_change(self.obj.selection)
}
NavigationLink(destination: MyFormView(self.obj)) {
Text("\(self.obj.array[self.obj.selection])")
}


Where the class contains:
Code Block
@ObservedObject var obj : MyClass

And in that class the array and selection members are @Published.

Many other views are using data from the observed object and displaying/updating correctly. It seems like SwiftUI somehow isn't figuring out that the strings are dependent upon the observed object, and I haven't been able to figure out a way to make it aware of this dependency (in SwiftUI 1.0... it looks like 2.0 might be adding an onChange modifier, but I cannot upgrade yet).

How can I get my views with interpolated strings to update properly?


How can I get my views with interpolated strings to update properly?

It depends on your view hierarchy. Just a few fragments of code would not help solving your issue.

Please show the code of the View exactly as is, and all the relevant code.
Ah, there is far too much code to include here (and the fragility of SwiftUI to its context is probably its biggest issue). I've solved the problem by adding @State members which I recompute from the original data source using a Combine subscription.
Swift UI Text view of interpolated string with observed object state not updating
 
 
Q