On 12 Oct, 2008, at 08:56, Roland King wrote:
If however you don't want the caller to modify the properties of the
objects *in* the array, then unless those objects are immutable,
returning a copy of the array won't help you anyway. Remember an
array of objects is just an array of pointers t
well first off you're returning an NSArray which is immutable, so
nobody can change the actual array itself, ie add or delete members
(unless of course you really actually return a mutable one and the
caller ignores the warnings and mutates it). If however you don't want
the caller to modif
I may be mistaken on this, but it sounds like there isn't a way to do what
you're trying to without making each array item immutable (such as NSString
instead of NSMutableString). The reason for this lies behind how pointers
work: once you have a reference, you can alter whatever is inside that
ref
oops... of course that should have been:
@property(readonly) NSArray *myArray;
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-ad
I'd like to have something like this in my class:
@property(readonly) *NSArray myArray;
But I don't want any of the individual objects in the array to be
modified, so I'd like to return a copy of the array. Is there a way of
getting @synthesise to ensure this? Or do I need to write m