I code in C# at work and in Swift in my home life. Each language has a default indentation style, different mostly on whether opening curly braces (“{”) are placed at the end of a line or at the beginning of a line of their own. The former style is called the “K&R” style, though I know it only as “the one true brace style.” The other style is called the “Allman style,” though I have never heard it called any name in particular, and think of it, myself, as “C# style.”

I leave my IDE code formatting defaults alone, so I have coded using the “one true style” in Xcode for Swift, and have coded using the C# style in Visual Studio. Both styles seem to work equally as well, but overall I prefer the way that the C# style helps ensure that all the opening and closing braces will line up.

I have been thinking this week to try to change my Swift coding style to match my C# coding style, but I can’t bring myself to do it. I can’t imagine using the C# style for Swift coding, or the “one true style” for C# coding; it just wouldn’t look or feel right. I found out that a lot of this stylistic distinction is based, as so much is, on historical precedent: influential textbooks or famous programmers set the way, and the rest of us follow. Maybe I will break with convention on my next Swift project, but probably not.