public Dependency and Sendable conformance #3490
Unanswered
stickeejosh
asked this question in
Q&A
Replies: 2 comments 1 reply
|
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 |
0 replies
|
I’m also considering making my reducer conform to Sendable. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
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
.runEffect from a Reducer I have to explicitly capture the dependency I am using e.g.In the VoiceMemos example project
@DependencyClient struct AudioPlayerClientdoes not have to declare conformance toSendableitself.However, the same error can be seen by changing the
AudioPlayerClientDependency andVoiceMemoReducer topublic.This explicit Sendable conformance can be seen in TicTacToe's
TwoFactorReducer andAuthenticationClientDependency.Can someone help my understanding of Sendable requirements by explaining:
publicscope of the Dependency and Reducer change the explicitSendabledeclaration requirements?internalscope?Thanks
All reactions