Skip to main content

Posts

Deep Diving Objective-C Properties (Part 1)

Properties Properties in objective c are a convenient way to provide the accessors (getter and setter) for instance variable in objective - c language. Let suppose you have a mobile then what are its properties? Name: Brand Name: Screen Size: etc. So properties define the things. In a similar manner properties in objective - c define the class or objects. A Simple Example for a Person class with the basic attribute. Example:  @interface  Person :  NSObject @property   NSString * name; @end Compiler will generate 
a getter and setter for you with the following convention: - ( void ) setName:( NSString *)name{     //Compiler generated the code for getter property } - ( NSString *)name{         //Compiler generated the code for getter property } From the above code there are some questions raised in mind? 1) W...