Anyone have an example of a custom text formatter?

I'm trying to visually split a nine-character code into three groups of three, as the user types the code into a textbox in an iPhone UI.


Apple says you subclass Formatter to do a task like this, but I can find no example of actually creating and using a custom formatter. The Apple doc refers to creating one to format a serial number, but gives no example. Then it links to doc about creating a custom one, but that is an ancient, archived doc that presents a laborious example of subclassing NSFormatter in Objective-C.


The few examples out there all use NumberFormatter or DateFormatter, and even then they don't seem to afford any particular convenience. I figured you could plug a Formatter into a UITextField somehow and it would use it, but this does not appear to be the case. So you wind up using shouldChangeCharactersIn anyway.


So... what's the point?


Thanks for any insight!