-
-
Notifications
You must be signed in to change notification settings - Fork 531
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
Fix Xcode 15.3 concurrency warnings when using Screen.scale
#766
Conversation
Hey, @jszumski. Thanks for raising the issue and taking a stab at it.
Right, I also would prefer to avoid limiting most of these APIs to the main-thread. What I would suggest trying instead is updating |
@kean Any pointers to where an async call to the MainActor might fit best? I don't know much about the internals of Nuke, but I assume the entire pipeline should be able to run in a background thread, so it would have to be done in an initial step somewhere and fed down into these other call sites? |
I briefly looked into it, and I'm really not sure. None of these potential solutions seem ideal. You need the pixel size during resizing and resizing happens in the background. I'm also not sure how pre-computing it would look like. After considering these options, restricting certain, but not all, initializers to the main thread doesn't seem like the worst option. |
If you remove the
|
85cbd65
to
3e03d0e
Compare
Updated with that fix. I'm honestly surprised it works. |
Yeah, it seems like a compiler bug. I gave up trying to find any official documentation on how it's supposed to work. The rules for Sendable will now probably require a separate book. Maybe it works because it's |
I wonder if |
Great suggestion! It looks like it is and it is not confined to the main thread:
I'm going to go with |
Fixes #765. The viral nature of concurrency unfortunately means that the blast radius is pretty high for just 2 warning fixes:
@MainActor
to direct and downstream callers ofScreen.scale
@MainActor
to downstream callers in tests@MainActor
from XCTestCases to individual test functions instead@MainActor
which would destroy its ability to test threading.