Closed utahwithak closed 2 years ago
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.
PR created #28
Thanks @utahwithak for raising this issue and @DavidKmn for the quick fix!
Merged and released in V0.2.1.
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,