My object looks like:
@interface MyObject : NSObject <NSCoding, NSCopying>
{
MyOtherObject* library;
NSString* identifier;
NSString* name;
BOOL removed;
}
@property (nonatomic, retain) MyOtherObject* library;
@property (copy, readwrite) NSString* identifier;
@property (copy, readwrite) NSString* name;
@property (readwrite) BOOL removed;
I need to be able to make a copy and have its properties be mutable (with
standard setters).
-(id)copyWithZone:(NSZone *)zone
{
MyObject* copy = [[[self class] allocWithZone:zone] init];
[copy setLibrary:[self library]];
[copy setIdentifier:[self identifier]];
[copy setName:[self name]];
[copy setRemoved:[self removed]];
return (copy);
}
This seems to work fine. So in my case is there really no difference between
a mutable copy and an immutable copy?
Thanks,
Trygve
_______________________________________________
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]