override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(ViewController.timerAction(_:)), userInfo: "Apple", repeats: true) } @objc func timerAction(_ timer:Timer) { let parameter = timer.userInfo print("I am eating \(parameter!).") }