Is there a way to fix SwiftLint's trailing whitespace violation?

Viewed 2218

I have a method that has has a closing bracket at line 20, I want my next method to start at line 23 because I want line 22 to have a comment. This will leave line 21 to have the one space between these two methods, but because line 22 is a comment SwiftLint will throw a "Trailing Whitespace Violation". Is there any way to fix this? White Space Violation Code

1 Answers

Trailing whitespace violation doesn't mean that there is an empty line, but rather that there is some unnecessary whitespace (not linebreaks, but tabs/spaces).

You can automatically fix trailing whitespacing by turning on the relevant feature in Xcode. You can find it in Xcode Preferences: Text Editing/Editing/While editing, turn on both "Automatically trim trailing whitespace" and "Including whitespace-only lines".

Related