• 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: Should I set Core Data dependent key in the primary's setter?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Should I set Core Data dependent key in the primary's setter?


  • Subject: Re: Should I set Core Data dependent key in the primary's setter?
  • From: Bill Cheeseman <email@hidden>
  • Date: Wed, 17 Aug 2005 17:50:45 -0400

on 2005-08-17 2:24 PM, Scott Ellsworth at email@hidden wrote:

> I want the logPop attribute in my core data model to change whenever
> the value of pop changes.

It's a little late in the day for me to think straight, but I'll give this a
go. If I understand what you're about, all you need to do is:

1. Define the attribute in your managed object model and mark it transient.

2. Implement your getter, and put all the calculations in the getter.

3. Forget about writing a setter.

The basic idea is that, any time Core Data tries to access the transient
attribute, it will call your getter, which will handle the calculation. And
the fact that it's defined as an attribute in the managed object model means
you can make use of all of Core Data's KVO stuff as if it were a persistent
value.

Am I overlooking something?

--

Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com

PreFab Software - http://www.prefab.com/scripting.html
The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes


 _______________________________________________
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

  • Follow-Ups:
    • Re: Should I set Core Data dependent key in the primary's setter?
      • From: Scott Ellsworth <email@hidden>
References: 
 >Should I set Core Data dependent key in the primary's setter? (From: Scott Ellsworth <email@hidden>)

  • Prev by Date: Re: NSApplicationMain() doesn't set NSApp to my subclass
  • Next by Date: Re: Dependent Keys
  • Previous by thread: Should I set Core Data dependent key in the primary's setter?
  • Next by thread: Re: Should I set Core Data dependent key in the primary's setter?
  • Index(es):
    • Date
    • Thread