watch changes to any properties on an object

2009-09-03 Thread Alexander Cohen
Hello, I have a base object that needs to know when any of it's properties or subclasses properties have changed and set a dirty flag on itself. Is there a way to do this? thx AC ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do

Re: watch changes to any properties on an object

2009-09-03 Thread Jens Alfke
On Sep 3, 2009, at 8:24 AM, Alexander Cohen wrote: I have a base object that needs to know when any of it's properties or subclasses properties have changed and set a dirty flag on itself. Is there a way to do this? No, not in general. Key-value observing requires knowing the exact

Re: watch changes to any properties on an object

2009-09-03 Thread Alexander Cohen
Ok, thats what i thought. But just for implementation ideas, how does CoreData know when one of it's @dynamic properties is changed? It must set some sort of flag somewhere in order to know what to write out when it needs to save. How does it handle that? thx AC On Sep 3, 2009, at 12:27

Re: watch changes to any properties on an object

2009-09-03 Thread Jens Alfke
On Sep 3, 2009, at 11:32 AM, Alexander Cohen wrote: Ok, thats what i thought. But just for implementation ideas, how does CoreData know when one of it's @dynamic properties is changed? It must set some sort of flag somewhere in order to know what to write out when it needs to save. How

Re: watch changes to any properties on an object

2009-09-03 Thread Alexander Cohen
Ah, ok, this is more like what i wanted to hear! :) I understand how @dynamic works, but how to I get to funnel all calls to @dynamic properties to the same call such as setValue:forKey: or something like that where i can parse the key and update my internal data and set the flags i need

Re: watch changes to any properties on an object

2009-09-03 Thread Ben Trumbull
Well, @dynamic doesn't have anything to do with KVO. It's just storage and accessors for properties. Core Data knows when non- dynamic modeled properties change too. It sets a dirty flag, just as you would have to. Most of that happens in -willChangeValueForKey:. Unfortunately,

Re: watch changes to any properties on an object

2009-09-03 Thread Quincey Morris
On Sep 3, 2009, at 12:14, Alexander Cohen wrote: Ah, ok, this is more like what i wanted to hear! :) I understand how @dynamic works, but how to I get to funnel all calls to @dynamic properties to the same call such as setValue:forKey: or something like that where i can parse the key and

Re: watch changes to any properties on an object

2009-09-03 Thread Quincey Morris
On Sep 3, 2009, at 12:44, Quincey Morris wrote: (call them dynamic if you want, but that's the same as their being compiled as @dynamic) I meant, ... that's *not* the same as ..., of course. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Re: watch changes to any properties on an object

2009-09-03 Thread Alexander Cohen
Overriding willChangeValueForKey: was one of the first things i tried before posting and I noticed it was not being called, i thought it was weird but nothing more. Good to know that overriding it was deprecated. Thx for the info on how CoreData manages it's saves. I was hoping to not have

Re: watch changes to any properties on an object

2009-09-03 Thread Alexander Cohen
On Sep 3, 2009, at 3:44 PM, Quincey Morris wrote: On Sep 3, 2009, at 12:14, Alexander Cohen wrote: Ah, ok, this is more like what i wanted to hear! :) I understand how @dynamic works, but how to I get to funnel all calls to @dynamic properties to the same call such as setValue:forKey: or

Re: watch changes to any properties on an object

2009-09-03 Thread Ben Trumbull
On Sep 3, 2009, at 12:14, Alexander Cohen wrote: Ah, ok, this is more like what i wanted to hear! :) I understand how @dynamic works, but how to I get to funnel all calls to @dynamic properties to the same call such as setValue:forKey: or something like that where i can parse the key and update