forked from OpenEmu/OpenEmu
-
Notifications
You must be signed in to change notification settings - Fork 0
Style Guide
cyco edited this page Feb 2, 2012
·
20 revisions
Herein lies some conventions used throughout the OpenEmu codebase.
This list is by no means exhaustive and quite prototypal as of yet.
- Braces on their own line
- (void)method
{
}- Pointer declaration
NSString *myString;-
Block argument list and types on their own line int (^blk1)(int) = ^ int (int v) { };
-
Use 4 spaces instead of tabs
@interface SomeClass
{
int ivar;
}- Class names are CamelCased
@implementation SomeClass
@end- Use YES and NO
- avoid 'dot-syntax'
Here you can see a sample class:
#import "someheader.h"
@interface SomeClass
{
int ivar;
}
- (void)method;
@end
@implementation SomeClass
- (void)method
{
if(booleanValue && obj != nil)
{
do
{
} while(value > 0);
}
while(value < 10)
{
}
void (^blk)(void) =
^{
// do things
};
int (^blk1)(int) =
^ int (int v)
{
// do things
};
}
@endFor more information read Apple's Coding Guidelines for Cocoa, since the project adheres to these.