Observing Collections
Observing Collections
- Subject: Observing Collections
- From: Chad Woolf <email@hidden>
- Date: Mon, 2 Jan 2006 18:18:56 -0500
Quick question (hopefully):
I want to observe a key on objects residing in a collection (NSSet
preferably but maybe an NSArray would work too). So, lets say I have
a collection of 10 objects, each having a key "enabled", and I want
to observe the value of the key "enabled" for each object, and also
track new objects coming and going from the collection. (I want to
do this because I want to maintain a separate collection of enabled
objects, and I want to it always be up to date)
This seems fairly fundamental because I've hit this pattern several
times, but I've yet to see an easy way to do it because when you need
to manage object life cycles and add and remove observers fairly
carefully. I've had to create a helper class to implement this
pattern, but I figured people have come across this before and there
is a much more elegant solution.
How would you do it?
Chad Woolf
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden