Skip to content

Instantly share code, notes, and snippets.

@shuiRong
Created December 3, 2017 09:11
Show Gist options
  • Save shuiRong/e2a9b31db2b3cc207166146d715db5cf to your computer and use it in GitHub Desktop.
Save shuiRong/e2a9b31db2b3cc207166146d715db5cf to your computer and use it in GitHub Desktop.
Timer
var timer = Timer()
timer = Timer.scheduledTimer(timeInterval: 0.1, target: self, selector: #selector(ViewController.updateTimer), userInfo: nil, repeats: true)
//更新timer
func updateTimer() {
counter = counter + 0.1
timeLabel.text = String(format: "%.1f", counter) + "--"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment