id2id Release 1 Objective-C Interface Declarations -> OmniGraffle Interface Diagram (c) Christian Pekeler, All Rights Reserved id2id is a command line tool that creates class diagrams from Objective-C header files. OmniGraffle is the output file format. id2id doesn't layout the diagram. That has to be done using OmniGraffle's auto layout feature or by hand. The diagram is constructed from templates. There is a template for a protocol, a template for a to-one association and so on. These templates are OmniGraffle documents and can therefore be edited. This release of id2id comes with two set of templates to create UML like class diagrams. When you edit templates or create your own set, be aware that this release of id2id isn't very fault tolerant with regard to the templates. If id2id can't handle a template, the behavior is undefined. id2id's parser purposely ignores instance variables from the interface declarations. Instead, instance and class variables are derived from the parsed accessor methods. A get and a set method are combined to a variable. An add method and at least a remove, a get or a set method are combined to a vector variable. (This doesn't always work because of irregular plural forms in English, for example -(void)addMouse: and -(NSArray *)mice are not recognized by id2id as belonging together.) Associations are derived from instance variables. Because of this derivative approach, categories and protocols are actually depicted with variables and associations in the diagram, and only directly mutable associations are displayed as associations. A preprocessor is not part of the tool. If preprocessor directives are used in a way so that the header file doesn't look like common Objective-C, id2id will not be able to parse it. Type 'id2id -h' for short instructions. usage: id2id [-hi] -t dir [-o file] [file ...] -h give this help -i version information -t dir directory with templates -o file to create, standard output is default file... files to parse, standard input is default Example for creating a detailed diagram from the ProjectBuilder framework. Assuming id2id and the template directory are in the working directory, do this on the command line: ./id2id -t DetailedTemplates -o /tmp/ProjectBuilder.graffle /System/Library/Frameworks/ProjectBuilder.framework/Headers/*.h open /tmp/ProjectBuilder.graffle then do this with the new document in OmniGraffle: Edit/Select All click on cursor right, or any other cursor key to move everything (this will resize the shapes to fit their text) File/Save File/Revert (this will resize the groups to fit their shapes) Edit/Select All Format/Align/Distribute Row (this will make all shapes visible) Format/Auto Layout (even if you want a force-directed layout, do a hierarchical layout first, this will make reflexive associations visible) and then, after some manual finetuning (reordering/resizing), the diagram should have a useful layout. Another example for creating a simple diagram from the AppKit framework including NSObject: echo "@interface NSObject @end" | cat - /System/Library/Frameworks/AppKit.framework/Headers/*.h | ./id2id -t SimpleTemplates -o /tmp/AppKit.graffle christian@pekeler.org THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ALL NAMES ARE USED FOR IDENTIFICATION PURPOSES ONLY AND MAY BE TRADEMARKS OF THEIR RESPECTIVE OWNERS.