Statement Position

Else and catch should be on the same line, one space after the previous declaration

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

Non Triggering Examples

} else if {
} else {
} catch {
"}else{"
struct A { let catchphrase: Int }
let a = A(
 catchphrase: 0
)
struct A { let `catch`: Int }
let a = A(
 `catch`: 0
)

Triggering Examples

}else if {
}  else {
}
catch {
}
      catch {