Enumerate property names and types for any class?

13 views
Skip to first unread message

david.ri...@enquora.com

unread,
Feb 24, 2017, 10:22:02 PM2/24/17
to Cappuccino & Objective-J
How does one enumerate a class property list in Objective-J, returning the property name and type for each?
The Objective-C class_copyPropertyList does not seem to exist in the Objective-J runtime.
Looking at the raw Javascript object has given me the property names ($CPObjectAccessorsForClassKey), but no more.

We need to dynamically build search predicates for representedObjects in multiple collection views as well as populate the template for a predicate editor, each to be used with a variety of classes.
Manually designing the predicate editor or creating class methods listing the searchable properties is a fallback, but would rather do this using reflection.

d.r.

david.ri...@enquora.com

unread,
Feb 24, 2017, 11:52:54 PM2/24/17
to Cappuccino & Objective-J
The answer seems to be using the enumerated property names in MyClass($CPObjectAccessorsForClassKey) to look up individual property types in myClass["ivar_dtypes"].
This is obviously implementation dependent - I'm guessing that class_copyPropertyList and property_getAttributes are awaiting volunteer effort to implement in the objj runtime rather than there being a technical impediment?

Am I barking up the wrong tree?

d.r.
Reply all
Reply to author
Forward
0 new messages