[swift-evolution] What about a VBA style with Statement?

Benzi to.benzi at gmail.com
Wed Apr 13 08:50:56 CDT 2016


The closest right now you can achieve would be:

func with<T>(item:T, apply:(T)->Void) {
    apply(item)
}


let label = UILabel()
label.highlighted // defaults to false

with(label) {
    $0.highlighted = true
}

label.highlighted // is now true
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160413/e2b18098/attachment.html>


More information about the swift-evolution mailing list