Skip to content
Discussion options

You must be logged in to vote

Hi @PereAlmendro, I'm not sure I fully understand your problem, but it seems to me that you want to conform to just TestDependencyKey, not DependencyKey, that way you don't have to provide a liveValue:

enum FOODependencyKey: TestDependencyKey {
  static var testValue: any FOODependencyProtocol {
    FooEmptyImplementation()
  }
}

(Aside: Even better if your FooEmptyImplementation invokes reportIssue in every protocol requirement that way you will get test failures if you ever use it in tests.)

Then in the entry point of your app you will prepare the live dependency:

@main 
struct EntryPoint: App {
  init() {
    prepareDependencies {
      $0.fooDependency = FooLiveImplementation()
    }
  }

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@PereAlmendro
Comment options

Answer selected by PereAlmendro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants