Giter Club home page Giter Club logo

swiftuml's Introduction

Swift to PlantUML

Using SourceKitten and PlantUML to generate UML class diagrams from swift source code.

Class diagram output without relationship

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 "FullyNamed" as FullyNamed << (P,GoldenRod) protocol >> {

}
class "Togglable" as Togglable << (P,GoldenRod) protocol >> {
  ~toggle()

}
class "Named" as Named << (P,GoldenRod) protocol >> {

}
class "Aged" as Aged << (P,GoldenRod) protocol >> {

}
class "CounterDataSource" as CounterDataSource << (P,GoldenRod) protocol >> {
  ~increment(forCount:): Int

}
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 "Starship" as Starship {
  ~init(name:prefix:)

}
class "Counter" as Counter {
  ~increment()

}
class "ThreeSource" as ThreeSource {

}
class "TowardsZeroSource" as TowardsZeroSource {
  ~increment(forCount:): Int

}
class "AnotherPublicClass" as AnotherPublicClass {
  +somePublicProperty
  -somePrivateMethod()

}
class "AnotherInternalClass" as AnotherInternalClass {
  -somePrivateMethod()

}
class "AnotherFilePrivateClass" as AnotherFilePrivateClass {
  ~someFilePrivateMethod()
  -somePrivateMethod()

}
class "AnotherPrivateClass" as AnotherPrivateClass {
  ~somePrivateMethod()

}
class "Rect" as Rect << (S, SkyBlue) struct >> {

}
class "Person" as Person << (S, SkyBlue) struct >> {

}
class "Person2" as Person2 << (S, SkyBlue) struct >> {

}
class "IntStack" as IntStack << (S, SkyBlue) struct >> {
  ~push(_:)
  ~pop(): Int

}
class "Stack" as Stack << (S, SkyBlue) struct >> {
  ~push(_:)
  ~pop(): Element

}
class "OnOffSwitch" as OnOffSwitch << (E,LightSteelBlue) enum >> {
  ~toggle()

}
class "Double" as Double25 << (E,orchid) extension >> {

}
class "Rect" as Rect26 << (E,orchid) extension >> {
  -init(center:size:)

}
class "Stack" as Stack27 << (E,orchid) extension >> {

}

Bicycle -u-|> Vehicle : inherits
Tandem -u-|> Bicycle : inherits
Train -u-|> Vehicle : inherits
Car -u-|> Vehicle : inherits
AutomaticCar -u-|> Car : inherits
Starship .u.|> FullyNamed : confirms to
ThreeSource -u-|> NSObject 
ThreeSource .u.|> CounterDataSource : confirms to
TowardsZeroSource -u-|> NSObject 
TowardsZeroSource .u.|> CounterDataSource : confirms to
Person .u.|> FullyNamed : confirms to
Person2 .u.|> Named : confirms to
Person2 .u.|> Aged : confirms to
OnOffSwitch .u.|> Togglable : confirms to
Double <.. Double25 : ext
Rect <.. Rect26 : ext
Stack <.. Stack27 : ext
@enduml



Dependencies

swiftuml's People

Contributors

palaniraja avatar gagoyal avatar

Stargazers

Andrei avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.