Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

My switch case is auto formatted when i do Cntrl + i , like below

switch someBool {
    ↓case true:
        print("success")
    ↓case false:
        print("failed")
}

but its throws a lint warning Switch and Case Statement Alignment Violation: Case statements should vertically align with their enclosing switch statement. (switch_case_alignment)

I have go manually format like below

switch someBool {
case true:
    print('red')
case false:
    print('blue')
}

but this changes as soon as i do Cntrl+I

Any suggestions are welcome. Thank you.

question from:https://stackoverflow.com/questions/66067006/switch-case-formatting-issue-with-swiftlint

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
877 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can adjust that setting on Xcode with the following checkbox. I think it comes unchecked by default, which should match SwiftLint's default rules.

Xcode indentation settings


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...