Detecting circular Dependencies in Swift code (Beta)

Oct 22, 2016

Most of the time circular dependencies are bad. You usually don’t want to have them. During the last couple of days I developed a small tool which finds circular dependencies in Swift code. It is not perfect but it works pretty well already. The tool finds circular dependencies between Swift files. You use the tool by integrating it into your Xcode build process. Once integrated the tool analyses your project every time you build it. The tool has to run while you work in Xcode.

Checker Integration

Circular dependencies are visualised like this:

Checker Report

You can click on the Swift icon to jump directly to the corresponding file. By default the most complex circular dependency is displayed immediately once the analyser has done it’s job. Use the popup menu to navigate to the other circular dependencies.


  • In rare cases circular dependencies are reported incorrectly. I am working on fixing that.
  • Circular dependencies are reported more than once. For example: If A depends on B which depends on C which depends on A creates 6 circular dependencies.
    • A → B → C; C → A
    • A → B; B → C → A
    • C → A → B; B → C
    • etc. This will be fixed by only reporting the most complex circular dependency and by ignoring smaller circular dependencies which are just a subset of a complex one.

Download Checker - Beta