Relative Content

Tag Archive for swiftstructvarupdateview

How to Automatically Update a View When a Variable Changes in Swift

I have a Flutter Application that regularly sends me “messages” with Data. In my ViewModel I have the code to decode the data and in my ContentView I make an @State private var viewModel = ViewModel, and pass variables from that viewModel Instance to my other Views through the NavigationLink in my ContentView. The ChallengeTabView (the simplified version that doesn’t work is below) accepts the currentChallenge and every time it gets changed I want the view to update.