One of the things that most, all?, developers dislike is creating documentation for their code. Coupling this with the fact that there are few solutions stretching multiple languages that make it easy for developers to use code for this task it is understandable why there are so few secondary representations of it. I am a visual learner so having “A” non-text view of the code is always helpful and through my career I have looked for ways to ease their generation. I don’t recall when exactly I found PlantUML but it makes creating many diagrams easy.
In the iOS world there is another great open source project SwiftPlantUML which provides a command line interface leveraging PlantUML for document generation from Swift files. Looking at my previously covered Network Manager class using swiftplantuml will generate an image like so
Simple enough to serve as a reference for usable entities. My Network Manager is simplsitic by design, but when looking at something like my project’s object Models and the
classes structs within a better example of PlantUML’s capability comes into view.
This view is generated from a further chunk of code and is completely editable itself, and can be stored in source control or hosted via whatever repository your company uses. My favorite usage is as a post build hook to update Confluence pages. An example of the PlantUML syntax is below. SwiftPlantUML generates this from Swift source files.