Say I have a list of model objects and a controller object which is interested in property changes to the individual model object. When I add the object, I use addObserver for each key it is interested in using KVO between the controller and the model object. Now, when one of the observed objects goes away, I need to tell the view controller to stop observing the changes on this individual object for the particular key.

What is an elegant way of doing this? The best way I can think of is to add a new key kRemoveObject which I call addObserver on in my controller that gets triggered right before the object gets deleted. Then I remove all the observed keys, including kRemoveObject for the particular instance. Does anyone know of a cleaner way? This seems a little bit cumbersome.