ConfettiView doesn't stop emitting
kevincador opened this issue · 1 comments
Hey,
I'm using this in a project and I'm facing an issue. I can't find the origin of the issue or a way to fix it properly.
After some time (seems to be when the app is running in the background and you come back to it after a while), the confettiView can't stop emitting confetti. It works great when you test several times but after a while, it seems like the CAKeyframeAnimation
doesn't stop, the CATransaction
completion block is never called and I'm stuck with a lot of confetti on screen 🎉
The only workaround I've found so far is to launch a timer and fade out the ConfettiView
myself, but it has not the same effect.
I don't know if it's the duration of the CAKeyframeAnimation
or something else that gets messed up.
I also wrapped all my emit call in DispatchQueue.main.async
just to make sure everything is running on the main thread but nothing does the trick so far.
I'm building on iOS 13 with Xcode 11.2.1. My emit duration
is 2.0. I'm adding the ConfettiView
on a UIWindow
that's on top of everything else.
Any help would be appreciated.
@kevincador I just pushed #8, which I believe should fix your issue. I wasn't able to reproduce exactly what you're describing, but it seemed to work better when quickly backgrounding / foregrounding the app. If this is still a problem, could you let me know whether this works for you?