title: Using Objective-C Metadata to Generate Class Dependency Graph
body: <p>This guy came up with a pretty neat tool to generate a class dependency graph - however, it relies on parsing your source code and looking for <code>#import</code> directives. </p>
  
  <ul>
  <li><a href="http://seriot.ch/blog.php?article=20110124" rel="noreferrer">http://seriot.ch/blog.php?article=20110124</a></li>
  <li><a href="https://github.com/nst/objc_dep/blob/master/objc-dep.py" rel="noreferrer">https://github.com/nst/objc_dep/blob/master/objc-dep.py</a></li>
  </ul>
  
  <p>This is neat, but I have a number of problems with this. Not least of which is it doesn't take into account imports of imports nor prefix headers nor whether-or-not the class(es) in the file referenced by the import are actually being used. </p>
  
  <p>I'd like to do something more akin to <code>class-dump</code> and examine the Objective-C metadata stored in the Mach-O file to generate an in-memory representation of the class dependencies. </p>
  
  <p>I'd rather not do this from scratch, so I'm wondering: </p>
  
  <ul>
  <li>Has it already been done?</li>
  <li>Is there an open-source library which would provide me with the foundational tools I need to extract this information (a library which examines the Mach-O file and creates a façade of the Objective-C information contained within - such that I could iterate over all of the classes, their methods, properties, ivars, etc and scan for references to other classes) I figure class-dump's source would be a good place to start.</li>
  <li>If you have experience in this sort of thing, is what I'm trying to accomplish feasible?</li>
  <li>What roadblocks will I need to overcome?</li>
  </ul>