I am a total noob and I'm learning.
I have a question: why I get an error after my application start?
This is the code for the timer:
Import UIKit
var counter = 0
class ViewController: UIViewController {
@IBOutlet weak var Label1: UILabel
@IBOutlet weak var Switch1: UISwitch!
var timer1 = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(timerAction), userInfo: nil , repeats: true)
@objc func timerAction() {
counter = counter + 1
Label1.text = String(counter)
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
Thanks a lot in advance!