Removing the observer

And finally, we need to remove ourselves as observer once we have finished observing. If we only need to react to the first occurrence of the property change, we might do that in the observeValue(keyPath: object: change: context:)method itself, but assuming we want to catch all of the property's changes, we put this in the class's deinit method.

Add the following code to the PeopleWatcher class:

    deinit 
{
removeObserver(self,
forKeyPath: "busy",
context: &myContext)
}

The code here is clear enough, methinks.