PlantUML

Installation

  1. You’ll want Homebrew
  2. brew install swiftplantuml
  3. brew install plantuml

Warning!!!

By default PlantUML uses a remote servce to generate images of .puml files. You can read more at plantuml.com/faq

Links to png or svg generated by PlantUML Server are valid forever (that is as long as the server is up). However, we do not store any diagrams on our servers. This may sound contradictory. It is not: the whole diagram is compressed into the URL itself. When the server receives the URL, it decompresses the URL to retrieve the diagram text and generates the image. There is no need to store anything. Even if the server is down, you can retrieve the diagram using the flag -decodeurl with the command line. Furthermore, the diagram data is stored in PNG metadata, so you can fetch it even from a downloaded image.


Make a Class Diagram

While this seems reasonable I want to generate the images locally. There makes for a two-step process:

  1. Generate .puml
  2. Generate .png

1. Generate .puml

swiftplantuml --output consoleOnly MyClass.swift > my-class.puml

2. Generate .puml

plantuml will crop the image if the size limit it set higher than needed.

plantuml -DPLANTUML_LIMIT_SIZE=14000 my-class.puml -png


References

PlantUML Homgepage

Excellent Blog Post

SwiftPlantUML


Getting Started

plantuml -help