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.
-
Hi folks 👋
Question
With
ReducerProtocol
andDependencyValues
, 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
Implementation
target, we are forced to implement the.testValue
property (at a minimum) in the sameImplementation
target. Here's why:@Dependency
property wrapper in the implementation of the feature'sReducerProtocol
require thatDependencyValues
is 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 atestValue
static property.Ideally, we would only want "unimplemented" versions of our dependencies to be included in the
Tests
target, and "live" versions of our dependencies in theDemo
target. But the way the API is structured, we are required to implement these in theImplementation
target. Sometimes this is not possible because theImplementation
target 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:EmptyDependencyKey
Feature Implementation/Interface Target
Demo/Live Target
Tests Target
Thanks for your time in advance 🙂
Beta Was this translation helpful? Give feedback.
All reactions