SwiftPlantUML
SwiftPlantUML copied to clipboard
Is there a option that draws 'Composition' as uml?
Is there a option that draws 'Composition' as uml?
You can modify the output of this command-line tool to add compositions as PlantUML supports this notation.
@startuml
Foo *-- Bar
@enduml
would result in

But SwiftPlantUML will not auto-generate this for you because I did not implement the composition (or association) detection in Swift code.
This Swift code
public class Foo {
private Bar bar = new Bar();
}
would result in the following PlantUML script generated by SwiftPlantUML command-line tool
@startuml
' STYLE START
hide empty members
skinparam shadowing false
' STYLE END
class "Foo" as Foo << (C, DarkSeaGreen) >> {
-Bar()
}
class "Bar" as Bar << (C, DarkSeaGreen) >> {
}
@enduml
And you want
@startuml
' STYLE START
hide empty members
skinparam shadowing false
' STYLE END
class "Foo" as Foo << (C, DarkSeaGreen) >> {
-Bar()
}
class "Bar" as Bar << (C, DarkSeaGreen) >> {
}
Foo *-- Bar
@enduml
Does this answer your question?
yes, that's a really good answer. I'll try it out! 👍🏻
Hi, are you planning on adding an option to detect Composition automatically? It'd be great to get insights regarding the coupling of the system, too
Hi @AlexPerathoner, it's not on my short-term list as I am worried about performance & cluttering the diagram. If you wanna take a shot and prepare a PR then I am happy to reviewing it