Buttons not working after animation stops

   func confettiStart() {

        confettiView.frame = self.view.bounds

        let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTap))

        view.isUserInteractionEnabled = true


    @objc func handleTap() {

I have the above function that showers confetti on the screen and when I click the screen, the confetti stops however there are buttons on the screen which work before the confetti comes but don't work after the confetti stops, please advise

Since this is about UIKit, and not the Swift language in particular, this is more of a question for the Apple Developer Forums.

However, the issue here is that when you add a tap gesture recognizer to a view, it takes priority over the gesture recognizers of its subviews -- in this case, the UIButtons. You'll need to remove the gesture recognizer inside handleTap, or add it to a subview that you place behind the buttons.

Terms of Service

Privacy Policy

Cookie Policy