Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 4 method braces "{" convention

I switched over to Xcode 4 while it was in beta, and I have mostly been editing existing code so haven't really considered this much until now...

Apple's file templates seem to have switched convention for coding methods. As an example, a pre-Xcode 4 dealloc method looked like this:

- (void)dealloc {
[super dealloc];
}

In Xcode 4, they now use this style:

- (void)dealloc
{
    [super dealloc];
}

As an avid perfectionist and irritable person, this has me quite miffed! I was brought up on the previous style in Xcode itself, and I'm now finding myself going through every template each time I create one to put the brackets back in the right place!

Please tell me this is a default option that I can change... or will I have to change my own coding style to match (or worse still, "learn to live with it" [shudder]!).

like image 279
Stuart Avatar asked Apr 28 '11 19:04

Stuart


1 Answers

I've never been able to get to grips with Xcode indentation. Instead I've ended up with a separate script that calls uncrustify (for ObjC) or indent (for plain C) to clean up the code before each commit. That way my coding style (the only sensible one, naturally) is consistently (fanatically?) enforced at all times.

This also catches other typical Xcode annoyances like trailing whitespace, which a reasonable code editor would strip at save time.

like image 130
Jakob Borg Avatar answered Sep 29 '22 06:09

Jakob Borg