Skip to content

Instantly share code, notes, and snippets.

@riosc
Last active August 29, 2015 13:57
Show Gist options
  • Save riosc/9776781 to your computer and use it in GitHub Desktop.
Save riosc/9776781 to your computer and use it in GitHub Desktop.
Efective Objective C 2.0
1. Prefer @class instead of #import as posible
- In headers files use @class, in implementation file use #import
- For protocol, separarte the protocol in other file (h)
2. Prefere literals instead of class methods
@YES, @1, @5.45f, ...
3. Prefer static cons instead of prepocesor # define
DURATION 0.3
static const NSInterval duration = 0.3; this is visible in implementatio file only
extern NSString * const text = @"Hola";
- For constants in local files prefix kName
- For constants Globals prefix CLASS_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment