-
Notifications
You must be signed in to change notification settings - Fork 507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Async Await #538
Comments
Just asking: what is the use case where it is justified to have an init async? 🤔 |
Easy - f.e. in |
I just modeled the above use-case and it seems to me that the actor Bar {
let baz: Int
init(baz: Int) {
self.baz = baz
}
}
class Foo {
let bar: Bar
init(bar: Bar) {
self.bar = bar
}
}
let bar = Bar(baz: 42)
let foo = Foo(bar: bar) I'm not saying it has no place in Swinject, I just don't see the use-case clearly yet, so please help me if you have time |
This is not what I meant. Try this to make happen:
..., and you can't ! B/c the only way to call |
But at the same time I anticipate that it won't be just as easy as adding a new |
Your thought here is very similar to my initial thoughts. It would be little complicated to do as is by just adding an It would be nice if the "Async Universe" was also backwards compatible "Non-Async Universe" which would limit the need to completely migrate for just async functionality. |
At the moment I don't have a lot of spare time to work out a POC but should after the new year, if it's not already done by then 😁 |
Any news regarding the stance on async/await in combination with Swinject? |
One thought perhaps could be along the lines of @mainactor conformance. If i want to use a dataStore and want the whole class to be wrapped in @mainactor so that updates have to be done on the mainThread i cannot initiate the class unless the init is also wrapped in @mainactor, and this propagates all the way to the assemble function having to be annotated with @mainactor but seeing as the protocol doesn't have @mainactor it will lose it's actor safety |
Would love some support with object that Async initializers as injected dependencies or just objects that are themselves async initialized.
The text was updated successfully, but these errors were encountered: