NSObject *clone = [self copy];
Wont perform deep copy but would be a shallow copy.
You need to implement NSCopying protocol like this
//ContactCard.h
@interface ContactCard : NSObject<NSCopying>
{
NSString* name;
NSString* email;
}
...
-(id)copyWithZone:(NSZone *)zone;
@end
//ContactCard.m
@implementation ContactCard
...
-(id)copyWithZone:(NSZone *)zone
{
ContactCard* cc = [[ContactCard allocWithZone:zone]init];
cc->email = [email copy];
cc->name = [name copy];
return cc;
}
...
@end
You can read more on enter link description here Or refer Apple docs on NSCopying