public Dependency and Sendable conformance #3490
Unanswered
stickeejosh
asked this question in
Q&A
Replies: 1 comment
-
Structs are only implicitly sendable when they are internal. It is by design that a public type needs an explicit You can avoid the issue of having to capture dependencies explicitly by making your reducer's conform to |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have modularised my project using Swift Packages and my Dependencies are mostly public with live implementations in separate modules to tests.
When updating to Swift 6 language mode I have to declare these dependencies as
Sendable
, enforced by the requirement fromTestDependencyKey
.When I use these dependencies in a
.run
Effect from a Reducer I have to explicitly capture the dependency I am using e.g.In the VoiceMemos example project
@DependencyClient struct AudioPlayerClient
does not have to declare conformance toSendable
itself.However, the same error can be seen by changing the
AudioPlayerClient
Dependency andVoiceMemo
Reducer topublic
.This explicit Sendable conformance can be seen in TicTacToe's
TwoFactor
Reducer andAuthenticationClient
Dependency.Can someone help my understanding of Sendable requirements by explaining:
public
scope of the Dependency and Reducer change the explicitSendable
declaration requirements?internal
scope?Thanks
Beta Was this translation helpful? Give feedback.
All reactions