How to set timer in swift?

var timer = Timer()
timer = Timer.scheduledTimer(timeInterval: 5, target: self,   selector: (#selector(self.upateTimer)), userInfo: nil, repeats: false)

@objc func upateTimer() {
}

inactive timer

timer.invalidate()