Hello, Thank You Point-Free!!!
I'm really enjoying TCA,
Can someone please help me how to make my count
property on State bindable in swiftUI where i want to asigen this count
property to a @Binding
property in SiwftUI.
couple of examples would be really helpfull.
struct AddToCartDomain: ReducerProtocol {
struct State: Equatable {
var count: Int = 0 // 👈 making this binding in SwiftUI
}
enum Action: Equatable {
case didTapAddToCartButton
case didTapPlusButton
case tapTapMinusButton
}
func reduce(into state: inout State, action: Action) -> EffectTask<Action> {
switch action {
case .didTapAddToCartButton:
return EffectTask(value: .didTapPlusButton)
case .didTapPlusButton:
state.count += 1
return .none
case .tapTapMinusButton:
state.count -= 1
return .none
}
}
}