[swift-evolution] Request for Discussion: Setup closures

Jonathan Hull jhull at gbis.com
Sun Dec 6 06:13:42 CST 2015


I often do the following:

let questionLabel:UILabel = {
    let label = UILabel()
    label.textAlignment = .Center
    label.font = UIFont(name:"DnealianManuscript", size: 72)
    label.text = currentQuestion.questionText
    label.numberOfLines = 0
    view.addSubview(label)
    return label
}()


> On Dec 6, 2015, at 3:59 AM, Adrian Zubarev via swift-evolution <swift-evolution at swift.org> wrote:
> 
>> let questionLabel = UILabel() .{
>>     ..textAlignment = .Center
>>     ..font = UIFont(name:"DnealianManuscript", size: 72)
>>     ..text = currentQuestion.questionText
>>     ..numberOfLines = 0
>>     view.addSubview($0)
>> }
>> 
>> Other thoughts?

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


More information about the swift-evolution mailing list