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:57:41 -0700
On 5/20/15, Jens Alfke <email@hidden> wrote:
>
>> On May 20, 2015, at 4:08 PM, Eric Wing <email@hidden> wrote:
>>
>> You could use the Objective-C runtime to find out which things are
>> properties.
>
> You could, but isn't it a lot easier to just look at the character before
> the name and check whether it's a "."?
>
> --Jens
It depends on how pedantic you want to be. For example, if you
implemented your own setter/getter methods, the dot syntax I believe
still works even though these technically aren't properties. The Obj-C
runtime functions I'm describing makes a harder distinction and will
only list things declared with @property.
-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