Use drafter Source Read

FIG generating class and method Drafter call graph (OC & SWIFT)

What is Drafter

  • Drafter is a command-line tool, code analysis for iOS projects, support Objective-C and Swift.
  • Parsing code and automatically generating method call graph.
  • Automatically generate code and resolve class inheritance diagram.

installation

The following instruction, automatically installed / usr / local / bin directory:

curl "https://raw.githubusercontent.com/L-Zephyr/Drafter/master/install.sh" | /bin/sh

Basic use

  • First, make sure the computer is installed Graphviz , can be installed directly through the Homebrew:brew install graphviz
  • The method of generating a call graph, in Bluetooth, for example, such as:
drafter -f ./AACenteralManager.m

To automatically generate a "filename + .png" format to name the pictures in the current location

Generating class inheritance diagram:

drafter -f ./Bluetooth -m inherit

parameter

  • -f, -file <arg>
    the necessary parameters to specify a file or folder, multiple parameters are separated by commas, spaces do not occur.

  • -m, -mode <arg>
    optional parameter specifying the parsing mode, the parameter value may invoke, inherit, both. represents only invoke analytical method invocation relationship, inherit showing an analysis only class inheritance relationship, both expressed simultaneously perform two analytical models. The default is invoke.

  • -s, -search <arg>
    between optional parameter specifying the keyword, a plurality of keywords separated by commas, the keyword case is ignored. The result of the analysis keyword filtering, leaving only the branch node containing the specified keyword, such as:

    drafter -f ./XXViewController.swift -s viewdidload
    
  • -self, -self-method-only
    parameter is optional only when the call graph parsing onset, only the method of generating the results of user-defined retention. Resolution call upon the relationship will all method calls are parsed out by default, the result of large files would be more messy, open the option to retain only the method defined in this document, make the results more clearly:

    drafter -f ./AACenteralManager.m -self
    

Guess you like

Origin blog.csdn.net/weixin_33904756/article/details/90805431