Skip to content
Discussion options

You must be logged in to vote

Hi @TicTocCroc, I believe there are two ways you can fix this. Rather than wrapping the creation of the Parent reducer in withDependencies, you should be using the .dependency reducer operator in the preview:

static var previews: some View {
  ParentView(
    store: Store(
      initialState: Parent.State(),
      reducer: Parent()
        .dependency(\.countClient, )
    )
  )
}

And another option is the Store initializer takes a trailing closure that allows you to override dependencies for the entire runtime:

static var previews: some View {
  ParentView(
    store: Store(
      initialState: Parent.State(),
      reducer: Parent()
    ) {
      $0.countClient = 
    }
  )
}

If neithe…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@tgrapperon
Comment options

@TicTocCroc
Comment options

@mbrandonw
Comment options

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