Skip to main content

Generate project graph

Graph#

When projects grow, it becomes hard to visualize the dependencies between all the targets that are part of the project. Fortunately, Tuist provides a command, tuist graph, that loads your project dependencies graph and exports it. As the saying goes, "one image is worth a thousand words":

Sample graph exported with the graph command

The command will output the dependency graph as an image, in the png format. You can also change the format to dot (see DOT) to get the raw contents of the graph.

Command#

Run the following command from a directory that contains a workspace or project manifest:

tuist graph

If you prefer to have the dot representation of the graph and render it separately, you can run:

tuist graph --format dot

To show the graph of only specific targets and their dependencies, you can run:

tuist graph FrameworkA FrameworkB

Legend#

The graph command will style every type of target or dependency differently. This makes it easier to understand and visualize the graph. App targets, swift packages, frameworks, and all other types will have different shapes and colors. To better understand what which one means, you can use the following legend as a reference.

Legend: different types of dependencies and targets and their styles in the graph

If you prefer the old style, without different colors and shapes, pass the --simple flag when creating the graph.

Arguments#

ArgumentShortDescriptionValuesDefaultRequired
--skip-test-targets-tExcludes test targets from the generated graph.No
--skip-external-dependencies-dExcludes external dependencies from the generated graph.No
--format-fThe format of the generated graph.dot, pngpngNo
--simple-sSimple graph: disable different shapes and colors.No
--algorithm-aThe algorithm used for drawing the graph. For large graphs, it's recommended to use fdp.dot, neato, twopi, circo, fdp, sfdp, patchworkdotNo
--path-pThe path to the directory that contains the definition of the project.Current directoryNo
--output-path-oThe path to where the image will be exported. When not specified, it exports the image in the current directory.No
--targets-tThe path to where the image will be exported. When not specified, it exports the image in the current directory.A list of targets to filter. Those and their dependent targets will be showed in the graph. If empty, every target will be showed.No