On Jul 19, 2012, at 6:13 AM, William Squires <wsqui...@satx.rr.com> wrote:

>  I'm wondering if there's some way to use introspection to figure out the 
> (primitive) type of a property, such as 'int', 'float', 'char', or 'BOOL' 

Sure — call the Obj-C runtime function property_getAttributes(). You'll first 
want to call class_getProperty() to get the objc_property_t pointer 
representing the property. If the property was declared in a superclass, you'll 
need to manually walk up the class hierarchy until you find the base class that 
has it.

For an example of how to use this, you can take a look at
        https://github.com/snej/MYUtilities/blob/master/MYDynamicObject.m
especially the functions getPropertyInfo() and getPropertyType().

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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