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":
The command will output the dependency graph as an image, in the
You can also change the format to
dot (see DOT)
to get the raw contents of the graph.
Run the following command from a directory that contains a workspace or project manifest:
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
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.
If you prefer the old style, without different colors and shapes, pass the
--simple flag when creating the graph.
|Excludes test targets from the generated graph.||No|
|Excludes external dependencies from the generated graph.||No|
|The format of the generated graph.||No|
|Simple graph: disable different shapes and colors.||No|
|The algorithm used for drawing the graph. For large graphs, it's recommended to use ||No|
|The path to the directory that contains the definition of the project.||Current directory||No|
|The path to where the image will be exported. When not specified, it exports the image in the current directory.||No|
|The 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|