Re: Make Custom Struct Key-Value Coding Compliant
Re: Make Custom Struct Key-Value Coding Compliant
- Subject: Re: Make Custom Struct Key-Value Coding Compliant
- From: Graham Cox <email@hidden>
- Date: Sun, 12 Feb 2012 17:56:52 +1100
On 12/02/2012, at 5:43 PM, Richard Somers wrote:
> I would rather not store it in the managed object as an object but would like to leave it as a struct and have it work just like NSPoint, NSSize, NSRect, or NSRange.
May one ask why?
The section of the documentation you posted spells out pretty clearly that what you want to do is not supported, you either have to make it an object or wrap it in NSValue.
Making it an object is easy and usually it turns out that the desire to resist doing that is misguided, based on some faulty assumptions. What are yours? If you need a scalar struct to pass to external code, just declare a method that will return that on demand, and a class method to make the object from the struct. Then any necessary conversion is also super-simple.
--Graham
_______________________________________________
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