Closure Spacing

Closure expressions should have a single space inside each brace

  • Identifier: closure_spacing
  • Enabled by default: No
  • Supports autocorrection: Yes
  • Kind: style
  • Analyzer rule: No
  • Minimum Swift compiler version: 5.0.0
  • Default configuration:
    KeyValue
    severity warning

Non Triggering Examples

[].map ({ $0.description })
[].filter { $0.contains(location) }
extension UITableViewCell: ReusableView { }
extension UITableViewCell: ReusableView {}

Triggering Examples

[].filter↓{ $0.contains(location) }
[].filter(↓{$0.contains(location)})
[].map(↓{$0})
(↓{each in return result.contains(where: ↓{e in return e}) }).count
filter ↓{ sorted ↓{ $0 < $1}}