Replies: 1 comment 3 replies
-
|
@ntbsp Can you explain more of your motivation behind wanting this separation? Test/unimplemented dependencies should be super lightweight, especially in release builds (most of that code is hidden behind The only place where a dependency might be heavyweight is the live dependency, which could depend on a third party library that takes a long time to build, but the live dependency key conformance can live in its own module, that only the app target depends on. Also note that |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi folks 👋
Question
With
ReducerProtocolandDependencyValues, is it possible to specify the dependencies of a module/target without implementing them?Background
Our project is composed of multiple features, where each feature is a set of separate targets (via Tuist). For simplicity's sake, let's say there are three targets for each feature:
Implementation,Tests, andDemo(live).Currently, if we want to define dependencies on our feature reducer in the
Implementationtarget, we are forced to implement the.testValueproperty (at a minimum) in the sameImplementationtarget. Here's why:@Dependencyproperty wrapper in the implementation of the feature'sReducerProtocolrequire thatDependencyValuesis extended with the same keypath in the same target.DependencyValues, the object used in the subscript operator must conform toTestDependencyKey.TestDependencyKey, we need to add atestValuestatic property.Ideally, we would only want "unimplemented" versions of our dependencies to be included in the
Teststarget, and "live" versions of our dependencies in theDemotarget. But the way the API is structured, we are required to implement these in theImplementationtarget. Sometimes this is not possible because theImplementationtarget does not depend on the "unimplemented" versions of our dependencies.Potential Solution
Implement an
(insert better name here) protocol that does not require a value of the dependency to be implemented (i.e. only require the Type and KeyPath of the dependency). Given that, we could define features like so:EmptyDependencyKeyFeature Implementation/Interface Target
Demo/Live Target
Tests Target
Thanks for your time in advance 🙂
Beta Was this translation helpful? Give feedback.
All reactions