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

Warning when using with @Published values #24

Closed
denizdogan opened this issue Oct 19, 2022 · 3 comments
Closed

Warning when using with @Published values #24

denizdogan opened this issue Oct 19, 2022 · 3 comments

Comments

@denizdogan
Copy link

denizdogan commented Oct 19, 2022

When using this library with @published values, I get the old familiar warning in Xcode:

Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates.

Note that this warning actually stems from Binding.withDelaysIfUnsupported(from:to:keyPath:) in the NavigationBackport source code, and not from my app source code.

Is this something that I should be worried about? Is it "just a warning"? Can we get rid of it by making some changes to the NavigationBackport library?

Related to #20

johnpatrickmorgan added a commit that referenced this issue Oct 21, 2022
… (#24)

It's not clear to me if the ObservableObject functions need to be marked @mainactor. They accept a keypath which
is used to access a potentially MainActor-isolated property, but I wonder if keypaths work around that issue somehow,
as there are no compile-time or runtime warnings if @mainactor is omitted. For now the annotations are left in until I
understand if and why they may not be needed.
@johnpatrickmorgan
Copy link
Owner

Thanks @denizdogan for raising this issue. I believe I've fixed it by correcting the missing @MainActor annotation on one of the withDelaysIfUnsupported methods. This is available in v0.6.1.

@denizdogan
Copy link
Author

@johnpatrickmorgan Sorry, didn't mean to leave you hanging, I honestly literally just had time to test the fix, and everything seems good. Thanks for your help!

@johnpatrickmorgan
Copy link
Owner

No worries, thanks for confirming!

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