Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?
Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?
- Subject: Re: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?
- From: Eric Wing <email@hidden>
- Date: Wed, 20 May 2015 16:08:05 -0700
> Which are they, ivars or properties?
>
> I don't know. I can't tell.
>
> Is there any way to inspect an instance and tell if it is a property or an
> ivar if both the property and ivar have the same name?
>
> Fun times, fun times.
>
You could use the Objective-C runtime to find out which things are properties.
Look for functions like:
objc_property_t * class_copyPropertyList ( Class cls, unsigned int *outCount );
ivars that are not properties will not show up as properties, so you
can cross-reference these with a master list you keep.
-Eric
--
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden