Tutifruti app, countdown timer before start playing.

I did a simple countdown function with swift:

I created a runTimer function that uses Timer.scheduledTimer calling updateTimer function each cycle, when seconds is equal to zero, timer stops and a new segue is calling in order to show play UI.

func runTimer(){
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: (#selector(self.updateTimer)), userInfo: nil, repeats: true)
func updateTimer() {
  seconds -= 1
  if seconds == 0 {
      counterLabel.text = “Empezar”
      self.performSegue(withIdentifier:”startSegue”, sender: self)
  } else {
      counterLabel.text = “\(seconds)”

I was trying to add some animation to it, but I think the result without animation looks pretty good:

Next step is pick random letter from alphabet and show it next to countdown timer for 3 minutes, like next prototype:

I'll continue posting…

Like what you read? Give Sergio Infante a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.