Replies: 1 comment
-
We would expect that any "internal" actions don't ever need to be scoped to. Can you explain a bit more why you are scoping to those actions, ideally sharing some compiling code that demonstrates what you are currently doing? |
Beta Was this translation helpful? Give feedback.
-
Hi folks 👋
My team is a big fan of TCA, and we build our software product using Swift Package Manager. When it comes to integrate our product into an app which is also using TCA, we need the feature to have
public
access so that we can compose it inside an AppFeature (reducer) in our app.In summary, we have something like this in the app:
For this to work, in the Package,
MainFeature
must be public. e.g.For this to work, it means that
OtherFeature.Action
at least must also be public - and this is a daisy chain effect. Everything which is referenced, inMainFeature.Action
must be public, which leaks all sorts of implementation details outside of the package.Swift 5.9 introduced the
package
access level modifier, which is great for a modular package codebase, and there are Swift evolution discussions around access level modifiers for enums. In the meantime though, does anyone have any techniques to get around this problem?What we've done so far, is to create a
public struct Action
in theMainFeature
to wrap aninternal enum _Action
. This allows us to make public some actions, but keep internal the child actions. We then had to jump through some hoops to try to createAnyCasePath
values, and needed to rely on deprecated APIs to scope the store. In general, I've found that it's pretty tricky to create aCaseKeyPath
by hand, because@CasePathable
cannot be used in this scenario.Beta Was this translation helpful? Give feedback.
All reactions