When using body to package multiple Reducers, the type check will not work. #2417
-
hi, I recently learned how to use bi-directional binding with BindingState, and I used body in place of the reduce method, but the type checking (completion) does not work properly. This happens even with a very simple Reducer as shown below. struct Toggle: Reducer {
struct State: Equatable {
@BindingState var isToggleOn: Bool = false
}
enum Action: BindableAction, Equatable {
case binding(BindingAction<State>)
}
var body: some Reducer<State, Action> {
Reduce { state, aciton in
switch aciton {
case .binding:
return .none
}
}
BindingReducer()
}
} For example, let's add an action called |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi, |
Beta Was this translation helpful? Give feedback.
Hi,
To fixe this you can add the generic State and Action to the reduce, like this Reduce<Sate, Action> { and autocompletion will work as expected.