4 ms·
> Not even leading indentation on blank lines. Ugh. I wonder how is this a real issue? Non-indented blank lines ARE an issue though - they make code editing m
by vemv 11y ago
> Not even leading indentation on blank lines.
Ugh. I wonder how is this a real issue?
Non-indented blank lines ARE an issue though - they make code editing more cumbersome, requiring pressing the tab key far more often.
Also, tabs are for bros.
- cyphar 11y agoIf your editor doesn't do smart tabbing, I'm sorry for you. Not to mention that random trailing whitespace is just annoying.
- to3m 11y agoPart of the problem is that Xcode (you know, the editor pretty much everybody will be using to write Swift) leaves blank lines indented. So to leave a blank line that doesn't have indentation, you press Return, and you get an indented blank line; you then need to press Backspace some appropriate number of times to get the cursor back to column 0; then you press Return. (In Xcode's defence, the cursor is, then, at least indented.) If you don't use Xcode, you might not realise how crap Xcode is.
- jashephe 11y agoWhile this is the default behavior, you can, at least in Xcode 7.2, check "Automatically trim trailing whitespace" and "Including whitespace-only lines" under "Text Editing" in Xcode's preferences.
- memco 11y agoIt might help you to use the OSX keyboard shortcut cmd + shift + [left, delete]. The left variant will move you to the beginning of a line, delete will clear all preceding characters and put the cursor on column 0.
- jankins 11y agoI'm on Xvim so I'd prefer to have non-indented blank lines for navigation with { and }. But I wouldn't suggest this guideline for projects where multiple devs since Xcode defaults to indenting blank lines. IMO you want to set yourself up for success as far as consistency goes, and that means sticking to defaults where possible.