If you are using the legacy API, i.e., the ObservableObject protocol, why are you defining the object using the @State property wrapper?
Instead, consider defining an object using the StateObject property wrapper.
I recommend delving into materials on SwiftUI development before publishing questions or code. It will provide you with a better understanding of the concepts.
🙂🙂🙂
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: