Hello everyone!
I would love to discuss two versus four spaces in indent. I know that some Obj-C base methods are simply too long in swift and so every indent space can become handy in legibility. However all Swift templates in Xcode contains four spaces indent which leads me to question. If two spaces are better why Apple didn't come with it in templates?
Is there other reason for two spaces instead of four than length of Obj-C methods?
Cheers!
It's right there in the guide:
Indent using 2 spaces rather than tabs to conserve space and help prevent line wrapping.
Especially for our books, horizontal space is at a premium. We're not saying two spaces are "better" and than Apple should change it 鈥撀爄t's just best for us.
gah, sorry about accidental close and reopen! stupid github.
@gregheo Yeah I know. It is spaces versus tabs. It give sense but two spaces are really tight makes it little bit harder to read in my opinion. I just wonder if there is something more behind decision using two spaces instead of four which is Xcode standard.
Oh I got it! So this repo is not general recommendation for Swift programmers. It's internal guide for your publications? Then I'm sorry. However I like the idea. I think style guide for languages are very useful.
Well the primary reason for the guide is for our publications. I like to think that nothing we recommend is _poor_ style that would be unsuitable for production use, and I've heard some other style guides use ours as a starting point or just for inspiration.
Personally, I use two-space tabs in "regular" life too, so I might be a bit biased. ;]
Most helpful comment
@gregheo Yeah I know. It is spaces versus tabs. It give sense but two spaces are really tight makes it little bit harder to read in my opinion. I just wonder if there is something more behind decision using two spaces instead of four which is Xcode standard.