Replies: 2 comments 2 replies
-
@sk409 Thanks for starting the discussion and opening a PR! While we theoretically understand how this would work in practice, we were hoping you could flesh out an example with some more real world motivation. Can you describe how you encountered this issue in your code base and why you had nested enum reducers? Was there something about your domain model that pushed you towards this design? Were there reasons the enum reducers couldn't have been flattened to be a single enum reducer with all of their cases? |
Beta Was this translation helpful? Give feedback.
-
Would it make sense to nest a navigation Path inside another navigation Path, in order to reuse a "subflow"? We have a bunch of features in different navigation contexts which all would like to launch the same subflow (which is several child features that navigate between each other). I haven't thought it through completely but it would seem natural to not want to flatten the subflow path in multiple different parent paths if the usage is always the same. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I updated to 1.8 and simplify the enum reducer, but TCA doesn't seem to support nested enum reducers.
NestedEnumReducer.body
should be used instead ofNestedEnumReducer()
in the following case:I propose to solve this problem by introducing ReducerCaseStatic.
Below is a specific example that led me to create this issue.
Nested enum reducers are not supported in Destination in the specific example below.
Motivation
I needed to switch fullScreenCovers with customized animation.
But SwiftUI does not allow multiple fullScreenCover to be enabled at the same time, so I decided to switch views in fullScreenCover's content with customized animation.
Following video describes what I mentioned.
2024-02-26.12.03.59.mov
For the above reasons, I designed the domain as below.
I implemented
modal
ViewModifier to switch views with customized animation.It is necessary to switch FeatureB/FeatureC/FeatureD as shown above, but since Modal needs to continue to be displayed, it was necessary to nest Modal inside Destination.
If you want the full code, see below.
Entire Code
Beta Was this translation helpful? Give feedback.
All reactions