-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
SwiftUI warning - publishing changes within a view (Xcode b5) #7908
Comments
I am experiencing the same warning when using The code causing the warning is line 205 in ObservableStoragePublisher. func send() {
subscribers.forEach {
_ = $0.receive() // <- This one
}
} It might be worth noting that I am not using any sync features, just a local database. |
me too +1 |
Still happening Xcode 14 beta 6, RealmSwift 10.28.6 macOS Monterey 12.5 |
In my case, it seemed to be tied to |
Hello. This issue was opened over a month ago. Will it be addressed? iOS 16 is out now, and developers want to upload/update their Realm apps. If we can at least have a statement that this warning is negligible (if that is that case) it would be very comforting. Thank you. |
this also affects navigationLink push in iOS16 |
+1 |
1 similar comment
+1 |
I've still been trying to figure out what's happening here. A couple of others have some interesting ideas. The issue seems to be affecting all developers, not just ones using Realm. If this warning is on purpose, and we're not supposed to bind published variables, I'm still thinking about what our team can do. But my first guess is this an Apple bug, especially given some reports say the warning can be suppressed by changing button styles. |
@ericjordanmossman It looks like your intuition may be right on target regarding this issue. Donny Wals tweet earlier today: "Heck yes! Xcode 14.1 Beta 3 (finally) fixed the "Publishing changes from within view updates is not allowed, this will cause undefined behavior" bug in SwiftUI https://www.donnywals.com/xcode-14-publishing-changes-from-within-view-updates-is-not-allowed-this-will-cause-undefined-behavior/ " |
I'm still seeing a bunch of these warnings at runtime with Xcode 14.1 beta 3, so perhaps that means that only a certain type of modification within a view update was addressed. |
I'm seeing this issue when defining a @GestureState variable in a class other than the view. The ui functions as expected but this warning appears. |
I'm getting this on 14.1 RC2 in Ventura, but I did not get it on RC1 on Monterey. |
In our app we're seeing a high number of these purple warnings consistently at runtime using Xcode 14.1 (formerly RC2) on Monterey. Now that 14.1 is final, this is making me more nervous about it. |
I also observe the runtime warning during the development of gitlapp using
This crash occurred a dozen times, the stack trace is always the same but originates from different views, all of which use Is there any workaround for this? |
I have the exact same issue with |
I have the same issue with @ObservedResults too |
Same issue.. Still not a peep regarding this from the team? |
One solution might be waiting for the observable storage to finish set up before calling |
I don't think this is the right solution. It causes a couple of legitimate testing failures. Needs to be looked into. |
Same issue waiting for the fix. |
This continues to be an issue in 10.33.0 |
This is something we are working out at the moment. We want to remove all the SwiftUI warnings that appear because of our property wrappers. I'll have a branch to test out soon. |
I have this branch #8068 which removes the warnings in both AsyncOpen/AutoOpen and ObservedResults in my sample project, can someone test it on their projects and check if they still are seeing the warning?. |
I’ll test it as soon as I can. (Could be a day or 2, depending)On Dec 14, 2022, at 11:53 AM, Diana Perez Afanador ***@***.***> wrote:
I have this branch #8068 which removes the warnings in both AsyncOpen/AutoOpen and ObservedResults in my sample project, can someone test it on their projects and check if they still are seeing the warning?.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: ***@***.***>
|
I can confirm that I don't see a warning with your branch 🎉 |
@PhilippeWeidmann can you confirm which property wrappers are you using? |
I'm using @ObservedResults . However I'm not using AsyncOpen/AutoOpen so I cannot confirm if it's also working for them |
I can also confirm that the warnings are gone for @ObservedResults. |
I can confirm that your branch removes the warnings for @ObservedResults |
Hey mostly good news for you on this. I tested our 2 apps that used @AsyncOpen @AutOOpeN and @ObservedResults using Xcode 14.2 (final) and your branch after running with latest production release of RealmSwift. Simulator was iOS 16.2. Both apps showed this warning from @ObservedResults running release version:
Running these apps rebuilt using the branch version made these warnings go away. Success! The only potential issue I found was of a somewhat different type, maybe not one I've seen mentioned yet in the GitHub here yet that I can recall. For one of my apps I was able to generate this warning:
Here is the full console output from the run with a little context before and after to show you what is up.
Seems to have happened just after starting the Realm session as I'm setting up several configured realms (each with different partitions). After this warning, the app seems to run fine without any other issues, and just to be clear I was seeing the "Publishing changes from UI thread...unexpected results warning by the hundreds all the time before I tested the branch, so that does seem to do the trick on that warning. |
Thanks to everyone for testing this branch. |
Fix merged, will be available on the next release |
How frequently does the bug occur?
All the time
Description
Using Xcode beta 5 triggers the following SwiftUI warnings:
No warning was present in the previous beta 3.
My project uses Realm Sync with the
@AutoOpen
property wrapper. Besides the warning, the code is working as intended.Stacktrace & log output
Can you reproduce the bug?
Yes, always
Reproduction Steps
Launch the complete code example from the SwiftUI quickstart on https://www.mongodb.com/docs/realm/sdk/swift/swiftui-tutorial/#complete-code
Version
10.28.5
What SDK flavour are you using?
MongoDB Realm (i.e. Sync, auth, functions)
Are you using encryption?
No, not using encryption
Platform OS and version(s)
macOS 12.5
Build environment
Xcode version: 14.0 beta 5
The text was updated successfully, but these errors were encountered: