SwSwift · Lesson 5 of 8
Collections & Closures
Arrays, dictionaries, sets — plus map/filter/reduce with Swift's famously terse $0 closure syntax.
✦ Tip
$0, $1 are shorthand for the closure's first and second arguments, and trailing closures drop the parentheses — that's how map { $0.name } gets so compact. Fine for one-liners; name the parameters when the closure grows.
$0, $1 are shorthand for the closure's first and second arguments, and trailing closures drop the parentheses — that's how map { $0.name } gets so compact. Fine for one-liners; name the parameters when the closure grows.