Dynamic properties
-
Deleted User
- Tag set to dynamic, kvc, property
- Title changed from add dynamic property support? to Dynamic property support
Hi,
I already have code for this from a project I started before ObjectiveResource came about. It automatically infers the properties as they are unserialized and stores them in a hash in the superclass. It also uses KVC to retrieve the properties (as suggested).
I would be more than happy to merge this feature if you would like to see it included in ObjectiveResource.
Josh
-
Deleted User
- Tag changed from dynamic, kvc, property to dynamic, kvc, properties
- Title changed from Dynamic property support to Dynamic properties
-
Joshua Vickery
Hi Josh (nice name!)
This ticket was at odds with #9 add OR support with category on NSObject? which moved ObjectiveResource from using a superclass, to implementing all the functionality as a category on NSObject. The downside of using a category is that there is no iVar support and, alas, Objective-C doesn't do "class" variables.
The only way that I now see to support this ticket would be to use a global or static map of objects to store all the attribute hashes, and I'm not to keen on that approach.
Do you have any other thoughts?
As a side note, the reason I wanted dynamic properties is because I almost always use iVar backed nonatomic,retain properties, which means that I need to repeat myself 4 times every time I want a new one.
@interface Foo { NSString *propertyName; } @property (nonatomic,retain) NSString *propertyName; @end @implementation Foo @synthesize propertyName; -(void) dealloc { [propertyName release]; [super dealloc]; } @endDynamic properties mean that I can cut that repetition down to 2, but my ideal solution would be not having to repeat anything. Does that mesh with what your logic?
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.