[swift-evolution] Request for Discussion: Setup closures

Thorsten Seitz thorsten.seitz at web.de
Sun Dec 6 07:47:23 CST 2015


Nice!
Actually I don’t mind the argument of the closure at all and would probably just name it after the class, i.e. „label“ in the example:

let questionLabel = UILabel() { label in
     
    label.textAlignment = .Center
    label.font = UIFont(name:"SomeFontName", size: 72)
    label.text = "Hello World"
    label.numberOfLines = 0
    view.addSubview(label)
}

-Thorsten



> Am 06.12.2015 um 12:59 schrieb Adrian Zubarev via swift-evolution <swift-evolution at swift.org>:
> 
> let questionLabel = UILabel() { this in /// <- REMOVE  
>      
>     this.textAlignment = .Center
>     this.font = UIFont(name:"SomeFontName", size: 72)
>     this.text = "Hello World"
>     this.numberOfLines = 0
>     view.addSubview(this)
> }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151206/fb2366f7/attachment.html>


More information about the swift-evolution mailing list