public Dependency and Sendable conformance #3490
Replies: 2 comments
-
|
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.
-
|
I’m also considering making my reducer conform to Sendable. |
Beta Was this translation helpful? Give feedback.
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
Beta Was this translation helpful? Give feedback.
All reactions