For the errata


p. 332, code after “Implement the Basic Formatter Methods”. Delete the following lines: [code]@interface ColorFormatter ()

  • (NSString *)firstColorKeyForPartialString:(NSString *)string;

[/code]’. In ColorFormatter.h before the last line, add the declaration - (NSString *)firstColorKeyForPartialString:(NSString *)string;


I puzzled over this too, but I think I worked out the reasoning behind it.

The other methods used are all standard NSFormatter methods, but firstColorKeyForPartialString: is a custom method.
So instead of just adding it to the sub-classed NSFormatter, it has been added as a part of an un-named category of NSFormatter.

Either way will work, but this way makes it clear which are the standard methods and which are not.


This is very much like the example on page 297, “For the More Curious: Declaring Private Methods”.

So yes, it is a custom method, but it’s more than that. Since it’s not part of the published interface for the class it’s declared as a private method. If a custom method (like sayIt: waaaay back in chapter 5) is part of the published interface, then it’s declared in the header file.