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
How to get rid of MainActor warning on all "it" tests? #1180
Comments
That's odd. You shouldn't be getting those warnings with Quick 6. It might be some weird caching behavior? I'll look into it some more later. Regardless, to improve your developer experience: Since you're compiling with swift 5.7 (Xcode 14), you can annotate the entire class as That is, instead of writing the following: class MySpec: QuickSpec {
override func spec() {
it("") { @MainActor in
expect(Thread.isMainThread).to(beTrue())
}
}
} You can instead write: @MainActor
class MySpec: QuickSpec {
override func spec() {
it("runs on the main actor") {
expect(Thread.isMainThread).to(beTrue())
}
}
} |
Adding MainActor to the spec class doesn't work for me as well =( It seems it doesn't work, since originally |
Hello, Is there a recommend solution for this, or should Thank you! |
This should be resolved as of Quick 7. Please re-open if it isn't. |
What did you do?
Using Quick v6, I had to add a lot of @mainactor to it("...") tests such as
That's because of the architecture of the project which is based on singletons which must run on the main thread at all costs.
This generates an xcode warning for every test (so there are hundreds and hundreds of warnings).
Is there a specific syntax to get rid of this warning?
Environment
List the software versions you're using:
The text was updated successfully, but these errors were encountered: