Hmm, I guess the way @State is managed in SwiftUI vs Compose's concept of state may mean @Binding isn't needed/applicable in Compose
r
robnik
12/20/2020, 3:00 PM
I'd say the equivalent to Binding in SwiftUI is MutableState. Swift is different here because they are using value types for so much. Because SwiftUI's
State
is a value type they, can't just pass a reference to it, so
Binding
is effectively that reference. While in Compose you just pass the MutableState down to nested Composables, either directly, or as the get/set pair.
👍 2
j
John O'Reilly
12/20/2020, 3:33 PM
I also wonder to what extent proper use of "state hoisting" avoids need for this approach as well