• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Make Custom Struct Key-Value Coding Compliant
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Make Custom Struct Key-Value Coding Compliant
      • From: Richard Somers <email@hidden>
    • Re: Make Custom Struct Key-Value Coding Compliant
      • From: Kyle Sluder <email@hidden>
References: 
 >Make Custom Struct Key-Value Coding Compliant (From: Richard Somers <email@hidden>)

  • Prev by Date: Make Custom Struct Key-Value Coding Compliant
  • Next by Date: Re: Make Custom Struct Key-Value Coding Compliant
  • Previous by thread: Make Custom Struct Key-Value Coding Compliant
  • Next by thread: Re: Make Custom Struct Key-Value Coding Compliant
  • Index(es):
    • Date
    • Thread