• 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: Recomputing non-standard Core Data attributes when child MOC is saved?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Recomputing non-standard Core Data attributes when child MOC is saved?


  • Subject: Re: Recomputing non-standard Core Data attributes when child MOC is saved?
  • From: Dave Fernandes <email@hidden>
  • Date: Wed, 19 Jun 2013 11:29:44 -0400

On 2013-06-19, at 3:21 AM, Rick Mann <email@hidden> wrote:

>
> On Jun 18, 2013, at 22:42 , Dave Fernandes <email@hidden> wrote:
>
>> The foolproof way to do it is to have the transient attributes recalculated each time they are accessed. In other words, they are simply getter methods. But if they are expensive to compute, this might not work well. If you are using bindings or KVO, you then have a class method + (NSSet*)keyPathsForValuesAffecting<AttributeName> that ensures observers of the transient attribute are notified when underlying non-transient attributes change.
>
> In this case, it's not accessed terribly frequently, so that's what I ended up doing. I do use KVO a lot, although I don't see how that helps in this case (to trigger re-computing the transient value).

It's not useful if you want to pre-compute and cache the transient values. It is just useful if the transient is a getter, and you need to notify the observers.

>
> Pity there's not an update method that can be overridden in NSManagedObjectSubclasses when this happens. I guess my objects could KVO themselves…
>
> --
> Rick
>
>
>


_______________________________________________

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


References: 
 >Recomputing non-standard Core Data attributes when child MOC is saved? (From: Rick Mann <email@hidden>)
 >Re: Recomputing non-standard Core Data attributes when child MOC is saved? (From: Laurent Daudelin <email@hidden>)
 >Re: Recomputing non-standard Core Data attributes when child MOC is saved? (From: Rick Mann <email@hidden>)
 >Re: Recomputing non-standard Core Data attributes when child MOC is saved? (From: Dave Fernandes <email@hidden>)
 >Re: Recomputing non-standard Core Data attributes when child MOC is saved? (From: Rick Mann <email@hidden>)

  • Prev by Date: Re: Recomputing non-standard Core Data attributes when child MOC is saved?
  • Next by Date: Restoring window state doesn't resize content view
  • Previous by thread: Re: Recomputing non-standard Core Data attributes when child MOC is saved?
  • Next by thread: Re: Recomputing non-standard Core Data attributes when child MOC is saved?
  • Index(es):
    • Date
    • Thread