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
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:
Replies
Boosts
Views
Activity
Aug ’22
Reply to SwiftUI localized enums in picker?
Oh I figured it out. It's not the .tag I have to change, it's the label! Changing to Text(settingsViewViewModel.selectedMode.localizedName) fixes the problem. Thanks
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’22