ViewBuilder content not updating on Binding change in SwiftUI
I have an Optional config isAttending
which starts out as nil
. When the “+” button is pressed it should set that value to a provided a default value and the Picker should show that as the selected value.
Child state is not updating as expected
final class ParentViewModel: ObservableObject { @Published var count: Int = 0 } struct ParentView: View { @ObservedObject var viewModel: ParentViewModel @Binding var navigationStack: [CShareSteps] var body: some View { VStack { Text(“Parent Count: (viewModel.count)”) Button(“Go to Child View”) { navigationStack.append(.test($viewModel.count)) } } .navigationDestination(for: CShareSteps.self) { step in switch step { case let .test(count): ChildView(count: count) […]