Question about setting instance variables in init method


#1

Example :

This is my .h file

[code] …
- (id)initWithCoordinate:(CLLocationCoordinate2D)c title:(NSString *)t;

@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
@property (nonatomic, copy) NSString *title;
...[/code]

This is my .m file

[code] …
@synthesize coordinate, title;

- (id)initWithCoordinate:(CLLocationCoordinate2D)c title:(NSString *)t
{
    self = [super init];
    if (self) {
        coordinate = c;
        [self setTitle:t];
     }
    return self;
}
....[/code]
  1. Could we just access the variable directly (i.e. title = t) instead of using the setter method ? What is the difference ? More memory efficient ?

  2. I know that coordinate is readonly and thus only has a getter method on synthesize. But if it was using the default ‘readwrite’ , should I use the setter method to set it instead ?