Re: Adding Properties to NKIssue?
Re: Adding Properties to NKIssue?
- Subject: Re: Adding Properties to NKIssue?
- From: Conrad Shultz <email@hidden>
- Date: Wed, 04 Jul 2012 18:30:23 -0700
On 7/4/12 2:27 PM, Dave wrote:
> Hi,
>
> That's more or less what we have at the moment and I think it's just
> fine and probably better in the long run. However someone else thinks it
> would be a better idea to do it my extending NKIssue if it is possible,
> but it seems it's not, since there is no way I can see of actually
> storing the property value anywhere, since you can't add iVar's.
A workaround in situations where you need to add storage is to use
associated objects.
See
http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/objectivec/Chapters/ocAssociativeReferences.html
and the Objective-C run-time reference for details.
It's really quite easy, and since NKIssue is only in iOS 5 and newer you
don't have any backward compatibility issues.
Note that you will need to import <objc/runtime.h> for the functions.
--
Conrad Shultz
Synthetiq Solutions
www.synthetiqsolutions.com
_______________________________________________
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