How to design a dependency limited to a specific actor? #3209
Replies: 2 comments 5 replies
-
Hi @romanatexn, typically one does not make the dependency itself an actor, main or otherwise, and instead one uses an actor under the hood of the dependency to power it. If you can provide a very simple, concrete example of a |
Beta Was this translation helpful? Give feedback.
-
The Web Sockets case study provides an example of how a dependency can wrap an actor, rather than being the actor. In this case, it is its own global actor, but there are lots of things you could do here, including using the main actor. |
Beta Was this translation helpful? Give feedback.
-
Context:
I'm using complete concurrency checking enabled and want to specify a dependency which is confined to the MainActor
`extension MyDependency: DependencyKey {
Problem:
I receive the following warning:
Main actor-isolated static property 'liveValue' cannot be used to satisfy nonisolated protocol requirement
Which is completely logical, but I don't know how to work around this warning.
Any ideas?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions