Extracting new value of a BindingAction #841
-
Hi, I am experimenting with new bindings and I'm wondering how to extract the new value from binding action used in following way: NavigationLink(
isActive: viewStore.binding(\.$isNavActive)
) {
EmptyView()
} label: {
Text("Navigate")
.padding()
}
[...]
let reducer = Reducer<State, Action, Void> { state, action, _ in
switch action {
case .binding(\.$isNavActive):
print(state.isNavActive) // prints false on tap
return .none
case .binding(_):
return .none
}
} ExpectationThe value of Actual resultThe value of What's the proper syntax for extracting new value for I expect there to be a new value for the action, because when I log from
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Oh I forgot about the a |
Beta Was this translation helpful? Give feedback.
Oh I forgot about the a
.binding()
suffix on the reducer.