Tutifruti app, pick random letter and reset countdown timer

Next step on my app is to show random letter from an array of letters and next to it a countdown timer.

When you tap on "Siguiente", next letter will appear. I write this simple function:

func randomLetter(letters: [String]) -> String {
    let total = letters.count
    let randomIndex = Int(arc4random_uniform(UInt32(total)))
    return letters[randomIndex]
}

Code looks like this:

And buttons functions:

@IBAction func nextLetter(_ sender: UIButton) {
    letterLabel.text = randomLetter(letters: alphabet)
    stopTimer()
    runTimer()
}
@IBAction func backToStart(_ sender: UIButton) {
    self.performSegue(withIdentifier: “firstSegue”, sender: self)
}

Next step will avoid random characters duplication. I need to figure out what will be my persistence data strategy.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.