Swift code to class diagram
I recently found a free tool, that gets you a decent start on this.
Take a look at this tutorial https://martinmitrevski.com/2016/10/12/swift-class-diagrams-and-more/
and here is the github repo https://github.com/yoshimkd/swift-auto-diagram.
I found its best if you open the diagram.html in chrome vs firefox. And if you see the little circles, just let it run until its finished. It takes a few minutes on my project.
There are a number of free and open-source tools but those often require the user to manually install additional dependencies (e.g. NodeJS, Graphviz or Python). Some of the projects are no longer maintained and are limited when it comes to functionality. And none of these tools were written in Swift.
So I started to work on such utility myself.
Xcode extension: https://github.com/MarcoEidinger/SwiftPlantUML-Xcode-Extension
You are able to generate a class diagram from selected lines of code or from a whole file displayed in Xcode. The class diagram will then be opened in your browser. There you can modify the diagram with PlantUML notation
To generate a class diagram from multiple source files you can use the underlying CLI tool and Swift Package: https://github.com/MarcoEidinger/SwiftPlantUML
There is a size limitation to the visible diagram content (but you can delete content in the browser with PlantUML notation)