Post

Replies

Boosts

Views

Activity

Reply to @published var not updating view
Ah I figured it out. Man, I always do this. I declare two @StateObjects of the same view model. I forget that you can only declare ONE @StateObject view model, and then any time you need to reference it you must use @ObservedObject var myViewModel: MyViewModel. And notice, not MyViewModel(). And then you have to try to figure out how to make the preview happy, which is not easy.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’22