Swiftuml
Script to generate plantuml class diagram from swift source code
Install / Use
/learn @palaniraja/SwiftumlREADME
Swift to PlantUML
Using SourceKitten and PlantUML to generate UML class diagrams from swift source code.

Usage
sh plantuml.sh demo.swift
If you want to run on multiple files at the moment, you can do some command line kung fu like below
ls -d "/directory/full/of/swift/files/"* | xargs -L 1 sh plantuml.sh | pbcopy
or if you list of files with fullpath
cat ~/Downloads/listOfFilesWithFullPath.txt | xargs -L 1 | xargs -L 1 sh plantuml.sh | pbcopy
once it copy everything to your clipboard (MacOS) you can paste it in your favorite text editor replace multiple @startuml and @enduml block and have just one startuml at top and enduml at the bottom
sh plantuml.sh demo.swift
will produce this diagram Full Image
Generates the below content, which you can copy and paste it in PlantText
@startuml
' STYLE START
hide empty members
skinparam shadowing false
' STYLE END
class "Vehicle" as Vehicle {
+makeNoise()
}
class "Bicycle" as Bicycle {
}
class "Tandem" as Tandem {
}
class "Train" as Train {
+makeNoise()
}
class "Car" as Car {
}
class "AutomaticCar" as AutomaticCar {
}
class "Double" as Double << (E,orchid) extension >> {
}
class "Rect" as Rect << (S, SkyBlue) struct >> {
}
class "Rect" as Rect8 << (E,orchid) extension >> {
+init(center:size:)
}
class "FullyNamed" as FullyNamed << (P,GoldenRod) protocol >> {
}
class "Person" as Person << (S, SkyBlue) struct >> {
}
class "Starship" as Starship {
+init(name:prefix:)
}
class "Togglable" as Togglable << (P,GoldenRod) protocol >> {
+toggle()
}
class "OnOffSwitch" as OnOffSwitch << (E,LightSteelBlue) enum >> {
+toggle()
}
class "Named" as Named << (P,GoldenRod) protocol >> {
}
class "Aged" as Aged << (P,GoldenRod) protocol >> {
}
class "Person2" as Person2 << (S, SkyBlue) struct >> {
}
class "CounterDataSource" as CounterDataSource << (P,GoldenRod) protocol >> {
+increment(forCount:)
}
class "Counter" as Counter {
+increment()
}
class "ThreeSource" as ThreeSource {
}
class "TowardsZeroSource" as TowardsZeroSource {
+increment(forCount:)
}
class "IntStack" as IntStack << (S, SkyBlue) struct >> {
+push(_:)
+pop()
}
class "Stack" as Stack << (S, SkyBlue) struct >> {
+push(_:)
+pop()
}
class "Stack" as Stack23 << (E,orchid) extension >> {
}
class "AnotherPublicClass" as AnotherPublicClass {
-somePrivateMethod()
}
class "AnotherInternalClass" as AnotherInternalClass {
-somePrivateMethod()
}
class "AnotherFilePrivateClass" as AnotherFilePrivateClass {
+someFilePrivateMethod()
-somePrivateMethod()
}
class "AnotherPrivateClass" as AnotherPrivateClass {
+somePrivateMethod()
}
Bicycle --|> Vehicle : inherits
Tandem --|> Bicycle : inherits
Train --|> Vehicle : inherits
Car --|> Vehicle : inherits
AutomaticCar --|> Car : inherits
Person ..|> FullyNamed : confirms to
Starship ..|> FullyNamed : confirms to
OnOffSwitch ..|> Togglable : confirms to
Person2 ..|> Named : confirms to
Person2 ..|> Aged : confirms to
ThreeSource --|> NSObject
ThreeSource ..|> CounterDataSource : confirms to
TowardsZeroSource --|> NSObject
TowardsZeroSource ..|> CounterDataSource : confirms to
Rect <.. Rect8 : ext
Stack <.. Stack23 : ext
@enduml
Dependencies
-
Generates output for PlantText*
Related Skills
node-connect
352.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
352.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
352.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
