Xcode broke switch case multiline indentation in swift?

Viewed 187

In previous Xcode versions switch case multiline indentation was:

switch error {
    case .authError,
         .decodeError,
         .dataNotExists:
    return "Error"
}

but now it's broken:

switch error {
    case .authError,
           .decodeError,
           .dataNotExists:
    return "Error"
}

or

switch error {
    case
            .authError,
            .decodeError,
            .dataNotExists:
    return "Error"
}

settings

Is there a way to fix this?

1 Answers

If you put all cases on new lines, including the first one, then it will get formatted in the way that you like, otherwise you could use AppCode and set a custom formatter or use a linter that would format switches using a set rule.

That is -

switch error {
case 
  .authError,
  .decodeError,
  .dataNotExists:
  return "Error"
}
Related