A few most favored Xcode text preferences

Line numbers. Seriously, how does anyone work without line numbers? They add context and reference for conversations and screen shots, especially in playgrounds. Text Editing > Editing > Show, Line Numbers

Trailing space trimming. Tidiness is godliness. Text Editing > Editing > While editing, Automatically trim trailing whitespace.  (I’ve never bothered with “Including whitespace-only lines” and vaguely suspect it would mess with indentation levels for braced scoping.)

Keyword highlights. I like the built-in highlighting feature that shows corresponding symbols after a short delay.  It’s a subtle cue that emphasizes “where else do I use this?” without having to enter “edit all in scope mode”. Text Editing > Editing > Highlight instances of selected symbol. I use a delay of 0.25 seconds, but I could imagine lengthening that so the highlights don’t appear until I’ve focused longer on a particular symbol.

Spaces. Need I say more? Text Editing > Indentation > Prefer indent using, Spaces. I’m an unabashed 4denterist. My tabs indent “in leading whitespace”. I’m not saying 2denting is bad or wrong but man can it be hard to read and interpret as visual columns. (“Would you like a pamphlet on how 4denting can save your eyes?”)

What about you? What is special about the way you’ve set up Text Editing preferences?


  • Leaving trailing spaces on white space only lines will cause problems with SwiftLint, sadly.

  • How does anyone work without line numbers? Pretty much the same way I read printed text without line numbers. If I want to refer to something, I use this “named enclosure” thingabob called a function. I heard some people use references to class names, members, and methods as well, but that seems a little outlandish

  • Tab key: Indents always. If you need a tab use opt-tab

  • Interesting: I don’t recall setting any of these preferences except line numbers in Xcode at my new job, and they are all set this way. These must be the new defaults?

  • Along with setting a 4 space indent, I also turn on Line Wrapping to 2 spaces. This makes it easy to see that the code belongs to the line above and not the next block level.

    Combined with the line numbers setting (which will gap when a line wraps over) I feel that this generally keeps things clean (especially when viewing diffs in side-by-side mode where horizontal space is at a premium, etc.)

  • I just started using the ligature font Fira Code, and I love it. Perhaps not everyone’s cup of tea, but worth a look for sure. https://github.com/tonsky/FiraCode

Join the Discussion

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>