• 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: How do I do KVC/KVO for struct properties
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I do KVC/KVO for struct properties


  • Subject: Re: How do I do KVC/KVO for struct properties
  • From: Derrick Bass <email@hidden>
  • Date: Fri, 17 Mar 2006 10:01:06 -0600
  • Resent-date: Fri, 17 Mar 2006 11:08:52 -0600
  • Resent-from: Derrick Bass <email@hidden>
  • Resent-message-id: <email@hidden>
  • Resent-to: email@hidden

On Mar 16, 2006, at 7:14 PM, Greg Herlihy wrote:

Overriding either valueForKey: or setValue:forKey: is very much a bad idea. You should review the Core Data
Can you explain why? I'm not exactly clear on how overriding these would do bad things. (Although I certainly believe it; bindings uses some evil magic!)

Programming guide:

http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/ index.html

especially the "non-standard attributes" section for the proper procedure. Essentially you should create a transient attribute for the struct property, assign it an "undefined type" and then use an NSValue object to wrap the struct so that it can be stored as an object. And yes, a custom accessor routine does need to manually send change noftifications whenever reading or writing an attribute of a managed object.

Okay, my application is not a Core-data application. Just a plain ol' Cocoa Bindings app that has to work on Panther too. I haven't written any Tiger-only apps so I haven't looked into Core data yet, and therefore that page was a little over my head... anyway, I got the impression that for bindings alone, all I'd have to do is replace my struct with an NSValue or NSData (or even a custom object of my own) and then the normal bindings mechanism would work. Is that correct?

Derrick

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: How to find out if a TCP port is in use?
  • Next by Date: Being a Service provider for Mail.app
  • Previous by thread: Re: How do I do KVC/KVO for struct properties
  • Next by thread: menuNeedsUpdate delegate
  • Index(es):
    • Date
    • Thread