It is quite easy to hookup view modifiers to TCA if said modifier accepts callback of type (A) -> ()
How is it possible to hookup view modifiers to TCA if modifier accepts callback of type (A) -> B
? Can I send the event with A
and return a value of type B
from the state?
This is how I image it happening:
.someModifier(perform: { instanceOfA in
viewStore.send(.someActionAccepting(instanceOfA)
return viewStore.instanceOfB
})
The fragment of reducer might look like this:
case .someActionAccepting(let instanceOfA):
state.instanceOfB = someCalc(instanceOfA)
return .none
Would store have already spun through and updated the value of instanceOfB
in reducer when action .someActionAccepting
arrived?