Confetti animation if the View Controller opens

// view controller of the Result Screen (second picture)
import ConfettiSwiftUI
import SwiftUI
import UIKit


class happyResultVC: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }
 
    

    
    @State private var counter: Int = 0
    func confetti() {
        counter += 1
        ConfettiCannon(counter: $counter)
    }
    
  
   if viewController.viewIfLoaded?.window != nil {
       
        confetti()
    }

So I'm trying that if the "happy number"-Result Screen opens that a animation of confetti appears. For that I am using ConfettiSwiftUI. Do you know if this is possible and how? Thank you!

Confetti animation if the View Controller opens
 
 
Q