> On 19 Nov 2015, at 08:15, Quincey Morris
> <[email protected]> wrote:
>
> On Nov 18, 2015, at 14:35 , Graham Cox <[email protected]> wrote:
>>
>> it’s just that if other code changes the attributes dictionary (such as the
>> Font Manager) then I need these split out properties to trigger their
>> notifications so that the UI shows the change
>
> I think I understand, finally. No, what you’re doing won’t work.
>
> The problem is that if (say) the Font Manager has a pointer to your
> NSMutableDictionary object, and mutates it — sets a new value for a key —
> there *will* be a KVO notification** — I believe we know that the standard
> NSMutableDictionary class issues KVO notifications for value changes, though
> I’m not sure whether it’s documented — but it won’t be a notification for the
> dictionary***, it will be a notification for the individual key.
>
I didn’t read his original question as saying that however, that he was
mutating an individual element of a mutable dictionary property. Grabbing what
was written
> So what I want (expect?) is that is code sets -dictionaryOfThings directly,
> an observer of ‘thingy’ will be triggered. Is that right?
which when you look at it doesn’t quite make sense, -dictionaryOfThings is a
method so you can’t set it so I assumed it meant replacing the whole dictionary
like so
myObject.dictionaryOfThings = newDictionaryOfNewThings;
or calling
[ myObject setDictionaryOfThings:newDictionaryOfNewThings ];
then the original dependent KVO code as-written should fire, for every property
which has dictionaryOfThings as a dependent key.
A bit of clarification about what was meant by ‘code setting
-dictionaryOfThings directly’ might help.
_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]