You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if there are more than one steps it will print out the following:
FlowStacksApp[55359:4275326] [SwiftUI] 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.
It appears that inside scheduleRemainingSteps when it does a Task.sleep when it comes back it will no longer be on the main thread and all remaining operations will execute on a random background thread pool thread.
Marking scheduleRemainingSteps as @MainActor solves this issue, though may have other implications.
This was tested on iOS 15 and 15.5 on simulators. Same thread changing behavior can be seen with a playground as well,
The text was updated successfully, but these errors were encountered:
Good catch, yes annotating the scheduleRemainingSteps to run on the main actor would be the correct solution. Will submit a PR shortly and attach to the thread.
This issue doesn't appear to happen when using the binding modifiers. I'm not sure why. But when using:
if there are more than one steps it will print out the following:
It appears that inside
scheduleRemainingSteps
when it does aTask.sleep
when it comes back it will no longer be on the main thread and all remaining operations will execute on a random background thread pool thread.Marking
scheduleRemainingSteps
as@MainActor
solves this issue, though may have other implications.This was tested on iOS 15 and 15.5 on simulators. Same thread changing behavior can be seen with a playground as well,
The text was updated successfully, but these errors were encountered: