Skip to content
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

Modifying state during view update #55

Open
ianthetechie opened this issue Oct 7, 2024 · 1 comment
Open

Modifying state during view update #55

ianthetechie opened this issue Oct 7, 2024 · 1 comment

Comments

@ianthetechie
Copy link
Collaborator

There appears to be an issue with modifying state during view update in one code path. The issue is that parent.camera is a @Binding, so we're mutating state up the chain.

In years past, I would have just reached for dispatch_async, even though it feels a bit dirty. This guy who claims to work at Apple also seems to agree that it's an acceptable solution as of 2021, but Swift 6 is still trying to figure out a new concurrency story which may complicate things. Does anyone have a better idea?

image
@Archdoog
Copy link
Collaborator

Archdoog commented Nov 2, 2024

Looking at MapKit. Pretty much every type is wrapped in @MainActor @preconcurrency, including their Map view, annotations, etc. Given this library is also just UI, a solution like that seems to make sense here as well. Anything you can think of that needs to be allowed to run on another thread?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants