I have a custom class (MyCustomClass) and within another class I need to
have MyCustomClass be a property whereby I make a copy (vs retaining).
MyCustomClass is quite complex and so I was considering using:
-(id)copyWithZone:(NSZone *)zone
{
MyCustomClass* copy = [NSKeyedUnarchiver
unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:self]];
return (copy);
}
This will of course incur a performance hit for the archiving but in my case
it is not very significant. However, naming conventions expect copy to not
be autoreleased so should the above really be:
return ([copy retain]);
?
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]