Why not add undo support in observeValueForKeyPath:ofObject:


I’m going through the book and right now it seems like the code to add undo support is placed in the KVC-methods for the array. Why not have add the undo actions observeValueForKeyPath:ofObject:change:context: instead? Something like:

- (void)observeValueForKeyPath:(NSString *)keyPath 
						change:(NSDictionary *)change 
					   context:(void *)context
	int kindOfChange = [[change objectForKey:NSKeyValueChangeKindKey] intValue];
	int index = [[change objectForKey:NSKeyValueChangeIndexesKey] firstIndex];
	Person *p;
	if (kindOfChange == NSKeyValueChangeInsertion) {
		p = [change objectForKey:NSKeyValueChangeNewKey];
		[[undoManager prepareWithInvocationTarget:self] removeObjectFromEmployeesAtIndex:index];
	} else {
		p = [change objectForKey:NSKeyValueChangeOldKey];
		[[undoManager prepareWithInvocationTarget:self] insertObject:p inEmployeesAtIndex:index];