maustinstar / liquid

Create a playful backsplash in SwiftUI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Liquid animation freezes until view disappears and reappears.

haroutig opened this issue · comments

I'm not 100% certain why this is occurring, and it may be something to do with my code, but whenever I update a variable in my app, triggering a change in my view, within a second the animation for Liquid freezes. It only resumes whenever i leave the view and reenter.

Screen Recording 2020-09-24 at 9 52 24 PM

It seems to only happen when updating the variable tracking progress through an environment object. I'm guessing it has to do with blocking the thread on which the timer for the animation is running, causing it to not continue the animation.

Can you post a code snippet to replicate this behavior on my end?

I think i found where the problem was, it seems that when using a variable in the new view rather than passing an environmentobject and reading directly from that, swift pauses animations until you retrigger them (in this case, leaving the view and coming back). No idea why this happens, may be a bug in swift or something i was doing wrong...