-
Notifications
You must be signed in to change notification settings - Fork 28
Coding Style Guide
This style guide outlines the coding conventions of the JotTouch SDK team. This document will continue to evolve, but at least this is a start.
Apple has already provided Coding Guidelines for Cocoa and the JotTouch SDK team has adopted these guidelines with the following additions and exceptions.
None so far!
Braces shall be used on all conditionals, even if they are contained to one line.
This is good
if(something) { return 1; }
This is bad
if(something) return 1;
Opening braces for methods should follow the Xcode preference of having it on the next line.
This is good
- (void)doSomething
{
This is bad
- (void)doSomething {
This is good
if (followingStandards) {
[self doItRight];
} else {
[self getLaughedAt];
}
This is bad
if (followingStandards)
{
[self doItRight];
}
else
{
[self getLaughedAt];
}
##Property Declarations Property declarations shall only use modifiers if they differ from the defaults. The defaults for a property are (strong, atomic, readwrite).
This is good
@property (copy, nonatomic) NSString *myString;
This is also good
@property NSArray *myArray;
This is bad
@property (strong, readwrite) NSArray *myArray;
Copyright (c) 2021 Adonit. All rights reserved.