I'm still pretty new to Objective-C coding (as evidenced by this question) and I think I'm not completely understanding how using the retain attribute in a @property declaration works.
Here is an example class:
@interface Foo : NSObject {
NSMutableArray *myArray;
}
@property (retain) NSMutableArray *myArray;
My understanding was that adding the retain attribute to the @property declaration (and using the necessary @synthesize delcaration in the implementation file) will basically do the following setter and getter for me:
- (void)setMyArray:(NSMutableArray *)newArray {
myArray = [[NSMutableArray alloc] initWithArray:newArray];
[newArray release];
}
- (NSMutableArray *)myArray {
return myArray;
}
Is this accurate or am I mistaken on how the retain attribute works?