Re: Detecting Managed Object Property Change From Undo Redo

2015-01-27 Thread Richard Charles
On Jan 27, 2015, at 11:28 AM, Kyle Sluder k...@ksluder.com wrote: Historically, I've not been a big Core Data user, but does -[NSManagedObject setPrimitiveValue:forKey:] not do what you want? That is a key-value coding method. If I remember correctly, key-value coding does not bypass

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-27 Thread Richard Charles
On Jan 27, 2015, at 2:24 AM, Quincey Morris quinceymor...@rivergatesoftware.com wrote: Clearly, all this customization takes some coordination between steps 1 and 2, even if it’s just to know which of them needs to be customized in any particular case, and how. That where the

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-27 Thread Quincey Morris
On Jan 26, 2015, at 23:32 , Jerry Krinock je...@ieee.org wrote: You seem to be saying that the only example given by Apple is a bad example, because it is a a nontypical, special case. I mean, most attributes in most apps are objects, not scalars. I’m not sure that it’s “bad”, though it

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-27 Thread Richard Charles
On Jan 27, 2015, at 1:34 PM, Quincey Morris quinceymor...@rivergatesoftware.com wrote: FWIW, there is yet another way to get to backing store from a custom primitive accessor — define another, private, Core Data property, and use *its* primitive accessors. This may seem clunky, but it’s

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-27 Thread Kyle Sluder
On Tue, Jan 27, 2015, at 01:06 PM, Richard Charles wrote: On Jan 27, 2015, at 11:28 AM, Kyle Sluder k...@ksluder.com wrote: Historically, I've not been a big Core Data user, but does -[NSManagedObject setPrimitiveValue:forKey:] not do what you want? That is a key-value coding method.

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-27 Thread Quincey Morris
On Jan 27, 2015, at 11:06 , Richard Charles rcharles...@gmail.com wrote: That is a key-value coding method. It’s not, as Kyle just said. FWIW, there is yet another way to get to backing store from a custom primitive accessor — define another, private, Core Data property, and use *its*

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-27 Thread Keary Suska
On Jan 27, 2015, at 9:52 AM, Jerry Krinock je...@ieee.org wrote: On 2015 Jan 27, at 06:46, Keary Suska cocoa-...@esoteritech.com wrote: Better, however, to have a property declaration, which would also synthesize an ivar in modern LLVMs (as of Xcode 5?). You mean the property

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-27 Thread Quincey Morris
On Jan 27, 2015, at 12:44 , Keary Suska cocoa-...@esoteritech.com wrote: That part of the conversation was private between you and Quincey. I am simply curious as I can't imagine why one would want to. It wasn’t intentionally private. It was just one of those cases where a post with a lot

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-27 Thread Richard Charles
On Jan 27, 2015, at 1:34 PM, Quincey Morris quinceymor...@rivergatesoftware.com wrote: On Jan 27, 2015, at 11:06 , Richard Charles rcharles...@gmail.com wrote: That is a key-value coding method. It’s not, as Kyle just said. Okay, you both win. It is a method which supports key-value

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-27 Thread Jerry Krinock
On 2015 Jan 27, at 12:44, Keary Suska cocoa-...@esoteritech.com wrote: What exactly happened when you specified the setter, but not the getter? I said I wasn’t sure because the project has a bunch of warnings due to ongoing major rework, but I just retested again. Answer: Compiler does

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-27 Thread Quincey Morris
On Jan 27, 2015, at 17:21 , Jerry Krinock je...@ieee.org wrote: Compiler does *not* warn if you have a custom primitive setter without a getter. FWIW, the compiler doesn’t warn you if you have any setter without a getter. I also tried to get it to compile without declaring the instance

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-27 Thread Jerry Krinock
On 2015 Jan 27, at 01:24, Quincey Morris quinceymor...@rivergatesoftware.com wrote: I’m not sure that it’s “bad”, though it is nontypical, which is why there’s a [nontypical] custom accessor. a Core Data property access has two general steps … you can customize one or both of these

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-27 Thread Keary Suska
What in the world is that nonCompliantKVCivar? I tried it in my project, on the ‘rating’ property as in my YouTube video. - (void)setPrimitiveRating:(NSNumber*)newRating { rating = newRating ; } Does not compile. The compiler never heard of ‘rating’. Same result if I change it

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-27 Thread Kyle Sluder
On Tue, Jan 27, 2015, at 12:21 PM, Richard Charles wrote: You can’t override a primitive accessor because one is dynamically generated for you at runtime if it is needed. If a custom primitive accessor is implemented then the managed object subclass must provide an ivar for backing storage.

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-27 Thread Jerry Krinock
On 2015 Jan 27, at 06:46, Keary Suska cocoa-...@esoteritech.com wrote: Better, however, to have a property declaration, which would also synthesize an ivar in modern LLVMs (as of Xcode 5?). You mean the property declaration would synthesize the ivar. I didn’t try that. I agree it would

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-26 Thread Richard Charles
On Jan 25, 2015, at 4:16 PM, Jerry Krinock je...@ieee.org wrote: The reason I had to run that test is because I don’t use KVO for observing managed object properties. Instead, I use NSNotificationCenter, which has these advantages… Where do you post the notification from for a managed

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-26 Thread Mike Abdullah
On 26 Jan 2015, at 15:00, Richard Charles rcharles...@gmail.com wrote: On Jan 25, 2015, at 4:16 PM, Jerry Krinock je...@ieee.org wrote: The reason I had to run that test is because I don’t use KVO for observing managed object properties. Instead, I use NSNotificationCenter, which has

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-26 Thread Jerry Krinock
On 2015 Jan 26, at 07:00, Richard Charles rcharles...@gmail.com wrote: Where do you post the notification from for a managed object property change? Just to clarify: Your question refers to how I do it in my real apps, using NSNotificationCenter, not how I did it in the YouTube video, which

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-26 Thread Jerry Krinock
On 2015 Jan 26, at 16:10, Richard Charles rcharles...@gmail.com wrote: It is not uncommon for this application to work with large data sets. I tested using KVO on a managed object property and undo took 34 seconds. I implemented custom accessors (public and primitive) containing custom

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-26 Thread Richard Charles
On Jan 26, 2015, at 12:10 PM, Jerry Krinock je...@ieee.org wrote: On 2015 Jan 26, at 07:00, Richard Charles rcharles...@gmail.com wrote: Where do you post the notification from for a managed object property change? Just to clarify: Your question refers to how I do it in my real apps,

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-26 Thread Jerry Krinock
On 2015 Jan 26, at 22:14, Quincey Morris quinceymor...@rivergatesoftware.com wrote: On Jan 26, 2015, at 17:55 , Jerry Krinock je...@ieee.org wrote: What in the world is that nonCompliantKVCivar? It’s just an ivar that was defined separately from this particular code fragment. It’s

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-25 Thread Mike Abdullah
On 25 Jan 2015, at 06:35, Richard Charles rcharles...@gmail.com wrote: Core Data generated primitive accessors are used to get and set values from and to the managed object's private internal store. Core Data generated primitive accessors do not have change notification. If primitive

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-25 Thread Jerry Krinock
On 2015 Jan 25, at 01:20, Mike Abdullah mabdul...@karelia.com wrote: You are mistaken. Core Data *does* fire KVO notifications during undo/redo. Although I wasn’t aware of this, I just did a little experiment and found that Mike is correct… http://youtu.be/PUHBAq-Me_4 On 25 Jan 2015, at

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-25 Thread Kyle Sluder
On Sun, Jan 25, 2015, at 05:16 PM, Jerry Krinock wrote: • Amount of code required is the same or less • Ability to coalesce and filter notifications per object or name • When an observer is being torn down you can remove all observers with one line of code, [NSNotificationCenter

Re: Detecting Managed Object Property Change From Undo Redo

2015-01-25 Thread Jerry Krinock
On 2015 Jan 25, at 22:03, Kyle Sluder k...@ksluder.com wrote: On Sun, Jan 25, 2015, at 05:16 PM, Jerry Krinock wrote: • When an observer is being torn down you can remove all observers with one line of code, [NSNotificationCenter removeObserver:self]. This is a dangerous API. If

Detecting Managed Object Property Change From Undo Redo

2015-01-24 Thread Richard Charles
Core Data generated primitive accessors are used to get and set values from and to the managed object's private internal store. Core Data generated primitive accessors do not have change notification. If primitive accessors are present, Core Data will use them during undo and redo. A managed