Closed romero-ios closed 2 years ago
I haven't tried running your upgraded @BindableState
code, but I read it over and noticed that you didn't call binding
on your upgraded reducer:
let loginReducer = Reducer<...> { state, action, environment in
...
}
.binding() // ←
Hope that helps!
Oh wow! I hadn't realized I missed that. It's working now - thank you @gohanlon
Hi, I'm trying to make FocusState correspond to BindableState as well.
.synchronize(viewStore.binding(\. $focusedField), self.$focusedField)
I can't find this modifier, if it has been renamed or if a library is needed, could you please tell me about it?
Hey @Ryu0118, it's defined in the case study about FocusState
Just a note, but this helper ships as a method called View.bind
in our SwiftUI Navigation library: https://pointfreeco.github.io/swiftui-navigation/main/documentation/swiftuinavigation/bindings/
In episode 155, the new
@FocusState
API was explored and an approach using the now deprecated.binding(action:)
higher order reducer was demonstrated. Below is the working code snippet:Upgrading the code to use the new
@BindableState
,BindableAction
API's, we get the following:When running the application, tapping on a
TextField
no longer updates theText
view that displays the name of the focused field.