-
-
Save m760622/45312a6d8f79f81f53a93c70ac769acf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var startNumber = 240 | |
var timer = Timer() | |
func runTime() { | |
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: (#selector(ViewController.tTimer)), userInfo: nil, repeats: true) | |
} | |
@objc func tTimer() { | |
if startNumber > 0 { | |
startNumber -= 1 | |
numberLabel.text = String(startNumber) | |
}else{ | |
timer.invalidate() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment