Replies: 1 comment 3 replies
-
@Alkenso Thanks for the discussion. I'm not sure I fully understand, though, so could you clarify a few things for me?
In general, depending on the reuse, we typically see two flavors:
Also, are you suggesting this as something to complement |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Guys, TCA is amazing framework. It solves lots of problems in v-v-very elegant way!
With the last update in Swift 5.7 it became awesome!
Have an idea/proposal regarding dealing with the Reducer.
The Problem
When dealing with Reducer, I have single place of modifying the State -
reduce
method that takes the State and the Action.In real-world apps there are lots of places where the code is similar or reused.
With current approach when I need additional functions to keep duplicated code, I have to pass at least
inout State
parameter all the time.The Proposal
Think about some auxiliary structure like (sorry for bad-naming =) )
or alternatively
Internal mechanics of TCA will
reduce
on itState
back from itConclusion
In such approach we get an ability to skip polluting each auxiliary function with
inout State
and/orAction
, accessing them directly from our variables.Mark auxiliary method as 'mutable' - it mutates the State
Do not mark as 'mutable' - it only reads the state
Beta Was this translation helpful? Give feedback.
All reactions