• 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: Changed Properties
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changed Properties


  • Subject: Re: Changed Properties
  • From: Quincey Morris <email@hidden>
  • Date: Wed, 23 Mar 2011 22:31:27 -0700

On Mar 23, 2011, at 20:08, Alex Kac wrote:

> I love using CoreData and one of my favorite features is its ability to get me the changed values between commits without any work on my end. I know I can do it the old fashioned way of putting bools and setter methods that mark those booleans as dirty on changes, but I was curious if there was a good way to perhaps use CoreData mechanics or other Obj-C mechanics to do the same sort of thing in NSObject directly-derived classes. It seems to me that perhaps some KVO method might be useful for this purpose.

I'm pretty sure the answer is a pretty flat no. I can only think of 4 ways it could be done:

1. Write an advanced version of properties that does (basically) the bool/setter thing for you, with a new API.

2. Integrate the bool/setter thing into KVO.

3. Mimic the KVO approach of swizzling setter method implementations at run time, and maintain your change information that way.

4. Use KVO to observe every property of every object.

#1 is actually feasible, though quite a tricky task. (The implementation is similar, I think, to parts of what various people have done for language bridges to Objective-C.) #2-4 all sound horrible.

FWIW.


_______________________________________________

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: 
 >Changed Properties (From: Alex Kac <email@hidden>)

  • Prev by Date: Help with Custom Control
  • Next by Date: Re: Problem with setAttributesOfItemAtPath:error:
  • Previous by thread: Changed Properties
  • Next by thread: Help with Custom Control
  • Index(es):
    • Date
    • Thread