square/PonyDebugger — pull request #82 by ryanolsonk (2013-09-09 06:19:57+00:00)
Title: View debugging object editing

View hierarchy debugging previously only supported editing for primitives, several common structs, and NSStrings. This change allows users to edit arbitrary object types by registering NSFormatter subclassses. Default formatters are provided for NSObject, NSString, NSNumber, NSDate, UIColor, and UIFont. The formatters provide the mapping from object to string and from string to object. A formatter is selected for an object by walking up its class chain and checking the registered formatters for a match. In this way, more specific formatters are preferred, with fallback to a general formatter. Not all formatters support editing - see PDGenericObjectFormatter for an example.

The formatter manager class is intentionally separated from the view hierarchy debugging code. I am thinking that the formatting logic could be useful for adding editing support to other parts of PonyDebugger, though I have not yet looked into doing that.