Yearly Archives: 2012

You can declares iVar-s in header files but it’s better in the implementation, so they will be really invisible for others. You should do this way: [crayon-5e2a550474087703815684/] But what if you forget the parenthesis and you put the variable simply beside the @synthesize? Like this: [crayon-5e2a550474091481091472/] The compiler will treat […]

ObjC ivar/global var declaration – a clarification

Avoid to use the Singletons – if possible Everybody knows the singleton pattern. If you want to allow in an app to use only one instance of an object you implement a static/class method which provides the instance for the caller and deny any other allocation. While there are situations […]

Singleton – the Anti-Pattern

About property and iVar usage in init/dealloc methods. Technically one use properties if he wants to publish a member. Make it accessible and/or modifiable without exposing the structure of the class. Properties also allows you to run a code (accessors) when the property is set (setter method) or get (getter […]

ObjC Properties vs iVars