• 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: Core data dependent attributes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core data dependent attributes


  • Subject: Re: Core data dependent attributes
  • From: "Seth Barber" <email@hidden>
  • Date: Fri, 26 May 2006 12:35:06 -0700

Apple's NSPersistentDocument Core Data Tutorial covers handling
derived values using KVO.  http://tinyurl.com/jp6s8 ought to help you
out.

As to using Xcode's data modeling tool to generate code for you, while
you are in the modeling view, go to "File" then "New File".  Under
"Design" there should now be the "Managed Object Class" option.  That
will do what you are looking for.


Best of luck.


On 5/26/06, Matteo Manferdini <email@hidden> wrote:
Hi everyone. I have a data model in core data in which an object has
a numeric attribute that depends on some calculations on attributes
of objects in a to many relationships. I need to keep this attribute
up to date.
If I were using a standard object I know I would have to use KVO, but
I don't know how to do this in core data's managed objects.
Since this attribute depends solely on other attributes, I don't need
to save it. Looking at core data's docs, I think I have to implement
a custom accessor method to compute the value. Is this right?
Moreover, can I use KVO in managed objects, so when the attributes
change the derived attribute will change as well? (somethin like
"Registering dependent keys" in KVO programming guide http://
developer.apple.com/documentation/Cocoa/Conceptual/KeyValueObserving/
Concepts/DependentKeys.html but using attributes of other objects).
One last question: core data programming guide states that I can use
the Xcode data modeling tool to generate the code for accessor
methods for any modeled property. How can I exactly do this?
Thank you very much.
Cheers.

---
Matteo Manferdini
 _______________________________________________
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



--
S.C. Barber
_______________________________________________
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


References: 
 >Core data dependent attributes (From: Matteo Manferdini <email@hidden>)

  • Prev by Date: Re: NSXLMDocument and malformed XML
  • Next by Date: Re: Writing out a BOOL value to a .plist
  • Previous by thread: Re: Core data dependent attributes
  • Next by thread: Writing out a BOOL value to a .plist
  • Index(es):
    • Date
    • Thread