Hi all, I have some code that works on iOS 14 up to 16 and now suddenly doesn't work on iOS 17 so I guess it's a regression. Here's a snippet of a minimal reproducible example.
SubView is supposed to update correctly when the button is pressed but that's not happening on iOS 17. onChange is not called either.
struct ContentView: View {
@ObservedObject var viewModel: ViewModel
var body: some View {
SubViewContainer(wrapper: $viewModel.wrapper)
}
}
struct SubViewContainer: View {
@Binding var wrapper: ValueWrapper
var body: some View {
SubView(value: $wrapper.value)
}
}
struct SubView: View {
@Binding var value: Bool
var body: some View {
Button(action: {
value.toggle()
}) {
Text(value ? "true" : "false")
}
}
}
class ViewModel: ObservableObject {
@Published var wrapper = ValueWrapper()
}
class ValueWrapper: ObservableObject {
@Published var value = true
}
Any clue what is going on?