What is the benefit of define constant by closure in Swift 3

Viewed 121
let a: UIView = {
    let a = UIView()
    a.frame = CGRect(x: 0, y: 0, width: 20, height: 20)
    return a
}()

I saw a lot of people's Swift source code defining let as this way. I just curious what is the benefit of this way?

1 Answers
Related