-1
私は「期待される宣言」を言うfunc pauseAction
下の行にエラーを取得し、単語「タイマー」Xcodeは、 "timer"という単語を指し示す矢印で「期待される宣言」と言っているのはなぜですか?
var timeLeft = 10
var timer = Timer()
var score: Int = 0 {
didSet {
scoreLabel.text = "\(score)"
}
}
@IBOutlet var scoreLabel: UILabel!
@IBAction func tapButton(_ sender: Any) {
score += 1
}
@IBAction func pauseAction(_ sender: Any) {
}
timer = Timer.scheduledTimer(timeInterval: 1.0, target:self, selector: Selector(("updateTimer")), userInfo: nil, repeats: true)
func updateTimer() {
timeLeft -= 1
timeLabel.text = String(timeLeft)
if timeLeft == 0 {
timer.invalidate()
}
}