You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
morganchen12 edited this page Nov 20, 2014
·
8 revisions
For the vast majority of the codebase, collaborators should adhere to Google's style guides, but all project-specific style and details not listed in Google's guides should be listed here. Please edit this document and add additional sections as necessary.
Constants should be declared as static const variables instead of #define macros. This allows the compiler to check for type safety and safeguards against poorly-named macros. Adhere to the Objective-C naming convention for constants used by Apple in order to maintain consistency with constants in our codebase and Apple's system libraries. Example:
static const int kNilOptions = 0; // Good
static const int NIL_OPTIONS = 0; // Not good
#define NIL_OPTIONS 0 // Bad
Internal private properties should be used instead of internal private instance variables. This allows for finer-grained control of autosynthesized variables through synthesized accessor methods, which should be overwritten as necessary. In the implementation of a class, self.property should be used in all places instead of _property except in initialization methods. Protocol conformations should also be declared publically.
Properties accessors should be called via dot syntax whenever convenient. This allows the compiler to throw errors if a property is not found and reduces verbosity. Shorter statements are especially important to adhere to the 80-character line limit.
cell.textField.text = @"sample text"; // Good
[[cell textField] setText:@"sample text"]; // Bad, less readable