Cheat Sheets
Deep Dives
Dependencies
Visualizing Dependencies
In highly modularized code, you can have dozens of modules with a complex web of dependencies. These dependencies can be visualized using the GraphViz Dot Language.
To do so, in your terminal, navigate to the directory that contains your Package.swift
file. Then run:
SPM will analyze the modules in your package and create a GraphViz dependency graph and store it in the dependencies.dot
file. Then run:
Now dot will create a visual graph of your dependencies in a .png
file!
Tools available
There are many tools available to customize the look of your visual graph such as Graphviz Online. These can be very helpful for adding extra features to your graph such as color coding the types of your modules (test targets, macros, executables etc.).