Hi all,
What is considered best practice when it comes to mutating many
properties of a managed object, specifically with regard to KVO
observers getting notified before all mutations are finished?
Let's say I have an Rectangle object. It has properties: colour, width,
height. Imagine some cont
On 31/10/2009, at 9:01 AM, Sean McBride wrote:
Hi all,
What is considered best practice when it comes to mutating many
properties of a managed object, specifically with regard to KVO
observers getting notified before all mutations are finished?
In situations like these I personally tend to av
Hi Sean,
I'd say you're going down the wrong path there.
Set each property individually. Yes, it will trigger a notification
for each one - doesn't or shouldn't matter, and unless you can show it
causes a performance problem, shouldn't be a cause for worry on that
score. It won't cause mul
> What is considered best practice when it comes to mutating many
> properties of a managed object, specifically with regard to KVO
> observers getting notified before all mutations are finished?
This is a problem intrinsic to the design of KVO. KVO is all about fine
grained per property notific
Graham,
Thanks for the detailed reply!
>I'd say you're going down the wrong path there.
Agreed, hence my post. :)
>Set each property individually. Yes, it will trigger a notification
>for each one - doesn't or shouldn't matter, and unless you can show it
>causes a performance problem, shouldn't
On 11/2/09 12:58 PM, Ben Trumbull said:
>> What is considered best practice when it comes to mutating many
>> properties of a managed object, specifically with regard to KVO
>> observers getting notified before all mutations are finished?
>
>This is a problem intrinsic to the design of KVO. KVO i
>> If your issue is that drawing or recalculation is occurring too
>> frequently after KVO changes, you can consider coalescing and deferring
>> the observers' actions instead of performing them synchronously. This
>> can be valuable even for less complex KVO issues.
>>
>> You could also refactor
On 11/2/09 12:58 PM, Ben Trumbull said:
>This doesn't really have anything to do with Core Data. However, for
>NSManagedObject, Core Data already provides the change coalescing and
>NSNotifications for you. You can respond within
>NSManagedObjectContextObjectsDidChangeNotification instead.
So I