What does 'finish in' mean in Swift?

Viewed 764

I'm a noob and have been learning from Apple's Playgrounds and random books doing tutorials. I'm working on a tutorial where it deals with a closure. I've seen this 'finish in' before in another tutorial but I don't know what it means precisely in layman terms.

What is it finishing, what is being finished, and inside of what? Or is there an idea of order of operation?

Here is the function where it was used:

func playSequence(index: Int, highlightTime: Double){
        currentPlayer = .Computer

        if index == inputs.count{
            currentPlayer = .Human
            return
        }

        var button: UIButton = buttonByColor(color: inputs[index])
        var originalColor: UIColor? = button.backgroundColor
        var highlightColor: UIColor = UIColor.white

        UIView.animate(withDuration: highlightTime, delay: 0.0, options: [.curveLinear, .allowUserInteraction, .beginFromCurrentState], animations: {
            button.backgroundColor = highlightColor
        }, completion: {
            finished in button.backgroundColor = originalColor
            var newIndex: Int = index + 1
            self.playSequence(index: newIndex, highlightTime: highlightTime)
        })
    }
1 Answers
Related