Is there a way to force Xcode to trim trailing whitespaces when I save file?
I'm using version 3.1.3 if that matters.
Starting from Xcode 4.4 whitespaces will be trimmed automatically by default, unless the line is all whitespace. You can also activate Including whitespace-only lines
to fix this, which is not active by default.
Go to Xcode > Preferences > Text Editing > While editing