Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 550
SRed Avatar asked Nov 02 '25 14:11

SRed


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".

like image 185
Dávid Pásztor Avatar answered Nov 04 '25 06:11

Dávid Pásztor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!