I'm trying to make a deep copy of an NSMutableArray
whose objects are instances of a custom class similar to this:
@interface CustomParent : NSObject
@property NSInteger Id;
@property (strong, nonatomic) NSString *IdStr;
@property (weak, nonatomic) NSDate *Date;
@property (strong, nonatomic) NSMutableArray *CustomChildren;
@property (strong, nonatomic) CustomType *Type;
@property float Value;
@end
I know there are lots of posts dealing with copying objects, but I don´t find examples for getting a complete copy of objects with collection members or properties. NSMutableArray *dstArray = [[NSMutableArray alloc] initWithArray:srcArray copyItems:YES];
raises an exception involving the copyWithZone
method.
How can I do this? Thanks!