IntrepidPursuits/swift-style-guide

Specify when not to use parentheses in chained closures

Opened this issue · 0 comments

For example, we should use:

let filteredFirstThing = myArray.filter { $0.belongs }.first

As opposed to:

let filteredFirstThing = myArray.filter({ $0.belongs }).first

Except in the case of a guard or if, where that would be right:

guard let filteredFirstThing = myArray.filter({ $0.belongs }).first else { return }