Saturday, August 23, 2008

@property and assign, retain, copy

From The Objective-C 2.0 Programming Language here is how assign retain and copy will be effectively implemented by @synthesize and how they should be functionally implemented by you if not synthesized.

property = newValue;
// retain
if (property != newValue)
{
[property release];
property = [newValue retain];
}
// copy
if (property != newValue)
{
[property release];
property = [newValue copy];
}

Labels: , , ,

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home