The problem here is that your data model is a class. The @State property wrapper is primarily designed to work with value types (like struct and enum). When you assign a new value to a @State variable, SwiftUI can see that the entire value has changed and re-renders the view. But with a class, the reference stays the same when you just change its properties, so SwiftUI doesn't notice and doesn't update the view.
However, that doesn't mean you can't use classes at all. The Observation framework allows a class to expose properties that, when changed, will cause the view to update.
So, you have two options:
Change your data model to a struct.
Add the @Observable macro to your data model.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: