Post

Replies

Boosts

Views

Activity

Comment on Why is @Binding not behaving as I expect here?
@Binding is not the right property wrapper to declare an ObservableObject inside a View. Use @ObservedObject or @StateObject to do that. @Binding is used for value type variables. Can you elaborate here? A struct is a value type? Or are you referring to my definition of final class StateProvider: ObservableObject {} and usage of $stateProvider.data? I think it would be a serious design limitation if we couldn't use a binding on an observable object, no?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’22
Comment on Why is @Binding not behaving as I expect here?
Yeah, just confirmed it works for me. This def. must have been a bug then.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’22
Comment on Why is @Binding not behaving as I expect here?
Ah, I am Xcode 14.0 Beta 3! Maybe we found a bug then??? Thanks so much @MauricevB! Let me try on latest version :D
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’22
Comment on Why is @Binding not behaving as I expect here?
@Binding is not the right property wrapper to declare an ObservableObject inside a View. Use @ObservedObject or @StateObject to do that. @Binding is used for value type variables. Can you elaborate here? A struct is a value type? Or are you referring to my definition of final class StateProvider: ObservableObject {} and usage of $stateProvider.data? I think it would be a serious design limitation if we couldn't use a binding on an observable object, no?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’22