Search code examples
iosswiftnstimer

Not able to pass Timer.sheduledTimer with parameters


basicPidTimer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(self.pidsUsage(indexPid:)), userInfo: pidsIndex, repeats: false)

//calling method bellow but not triggering anyhelp?

@objc func pidsUsage(indexPid : Int){

}

Solution

  • The parameter needs to be of type Timer. I.e.

    @objc func pidsUsage(timer : Timer) {
    
    }