> 
> On May 16, 2013, at 11:41 PM, Graham Cox <graham....@bigpond.com> wrote:
> 
>>> There is setValue:forUndefinedKey: and then each object could keep a local
>>> dictionary of these "defined at runtime" keys.
>> 
>> There are low-level runtime methods that allow you to add properties at
>> runtime. I'm not sure whether that's considered good practice, but it's
>> doable.
> 
> MYDynamicObject is a class I wrote that enables this:
> https://github.com/snej/MYUtilities/blob/master/MYDynamicObject.h
> You can subclass this, add properties to the @interface, and then mark them as
> @dynamic in the @implementation. Then you just need to implement a generic
> getter and setter method to do something like store the value in an internal
> mutable dictionary.
> 
> (This is just like what NSManagedObject does with @dynamic properties, only in
> a more generic form.)
> 
> —Jens

How is this really any different than using setValue:forUndefinedKey?




_______________________________________________

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-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 arch...@mail-archive.com

Reply via email to