NSHipster/ConfettiView

Confetti failing to launch in simulator

thisisjeffwong opened this issue ยท 2 comments

Has anyone noticed confetti failing to emit particles in the simulator? I'm using Xcode 12.4.

I have never observed this on device however.

mattt commented

I wasn't able to reproduce this on the simulator, and haven't seen this happen on the device, either.

If anyone else experiences this, please let me know and I'll reopen this issue for further investigation.

I'm definitely experiencing this issue. Both in simulator and on a device. (although the device I'm testing on today isn't having as many issues as the simulator, and it's difficult to reproduce there except after I run my app for the very first time). I was using Xcode 12, and am now using Xcode 13.0. The problem seems worse in the simulator when running iOS 15. I've been attempting to narrow down what the issue is, and it seems the more shapes I have in the confetti the more often it won't actually emit. 4 or 5 shapes seems like too many; but three seems to work the majority of the time.

I'm confirming that my code to build the confettiView is always being called. I set the backgroundColor of the confettiView to make sure it's being added and it is. I put a print into the callback send to the emit method, and the print doesn't show up until after the timer would runout from actually showing the confetti.

Here's how I'm calling it:

confettiView = ConfettiView()
confettiView.backgroundColor = .systemPink.withAlphaComponent(0.5)
self.view.addSubview(confettiView)

confettiView.emit(with:
          [ .text("๐ŸŒธ"), .text("๐ŸŒผ"),
              .text("๐Ÿ”…"),
              .text("๐Ÿน"),
              .shape(.circle, .purple)],
        for: 3.0) { [weak confettiView] thebool in
        print("Completion after emit")
        confettiView?.removeFromSuperview()
}