I know this is a fairly contentious issue amongst programmers, but when developing I like my IDE to position the opening curly bracket underneath the method/interface/control declaration, for illustrative purposes: -
This is how Xcode automatically generates skeleton methods with the { at the end: -
-(void) isTrue:(BOOL)input {
if(input) {
return YES;
}
else {
return NO;
}
}
This is how I like to lay out my code (which I believe is called the Allman style): -
-(void) isTrue:(BOOL)input
{
if(input)
{
return YES;
}
else
{
return NO;
}
}
I'm just wondering if there's any configuration switch in Xcode to enable this style of development? It's really annoying when typing out if
/else
statements as it tends to auto-complete the else
clause with the {
at the end of the line which just looks silly if you like developing with them underneath.
Or am I being unreasonable? Is Objective-C supposed to adhere to a standard defined by Apple?
Take a look at:
Xcode: Adjusting indentation of auto-generated braces?
Apple Xcode User Defaults
XCCodeSenseFormattingOptions = {
BlockSeparator = "\\n";
PreMethodDeclSpacing = "";
};
This should at least solve your problem after if
, for
, or while
statements.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With