samuelgoto / proposal-block-params

A syntactical simplification in JS to enable DSLs
204 stars 8 forks source link

[Swift] Trailing closures #34

Closed julien-c closed 4 years ago

julien-c commented 6 years ago

https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Closures.html#//apple_ref/doc/uid/TP40014097-CH11-ID102

I love the Swift syntax for parameters in trailing closures and thought it'd be helpful to list it too:

let strings = numbers.map { n in
    return n**2
}