Xcode 12 broke multiline guard indentation in swift?

266 Views Asked by At

With one line guard Xcode 12 make right indentation:

guard let contentName = vod.name else {
    Log.fault("No data.")
    return
}

but with multiline, the indentation is broken:

guard let contentName = vod.name,
      let season = vod.season else {
          Log.fault("No data.")
          return
      }

Am I doing something wrong or there are someone with the same problem?

2

There are 2 best solutions below

0
Nike Kov On BEST ANSWER

In Xcode Version 13.3.1 (13E500a) it seems to be fixed

0
de. On

I can reproduce this with Xcode 13.1

Interestingly it works fine for multi-line if let.

The "Preferences/Text Editing/Indentation"-menu does not offer any option to fix this.

I have submitted a bug report in the Apple feedback assistant (FB9958961, it's probably non-public?).
I am afraid that is all we can do at this point:

  • raise awareness for the issue through a Stack Overflow posting ✅
  • file a bug report ✅
  • consider using AppCode instead of Xcode …