diff --git a/.assets/exampleDiagram.svg b/.assets/exampleDiagram.svg new file mode 100644 index 0000000..bce8c47 --- /dev/null +++ b/.assets/exampleDiagram.svg @@ -0,0 +1 @@ +«protocol»aProtocolaProtocolInstanceVar : StringaProtocolInstanceMethod(param1:param2:)aClassaPublicInstanceVar : StringaStaticPublicInstanceVar : StringanInternalInstanceVar : DoubleaPrivateInstanceVar : IntaPublicInstanceVarTypeInferenceinit()aPublicInstanceMethod(param1:param2:)aStaticPublicInstanceMethod(param1:param2:)anInternalSubClassaSubInstanceVar : StringlinkToStruct : aPublicStruct?init()aSubInstanceMethod(param1:param2:)anInternalClassanInternalInstanceVar : DoubleaPrivateClassanInternalInstanceVar : DoubleaPrivateGenericClassElementelements : [Element]aPrivateGenericSubClassElementotherProp : String«struct»aPublicStructaPublicInstanceVar : StringanInternalInstanceVar : DoubleaPrivateInstanceVar : IntaPublicInstanceVarTypeInferenceaPublicInstanceMethod(param1:param2:)aStaticPublicInstanceMethod(param1:param2:)«struct»anInternalStructanInternalInstanceVar : DoubleaPrivateInstanceVar : IntaPublicInstanceVarTypeInference«enum»AnEnumsimpleCaseanInternalComputedVar : AnEnumcaseWithRaw(_:)caseWithRaw(_:_:)anInternalInstanceMethod()aStaticInternalMethod()«extension»aPublicStructanExtensionComputedInstanceVar : StringanExtensionInstanceMethod(param1:param2:)«extension»aPublicStructaProtocolInstanceVar : StringaProtocolInstanceMethod(param1:param2:)«extension»anInternalStructanExtensionComputedInstanceVar : String«extension»anInternalStructanFileprivateExtensionComputedInstanceVar : Stringinheritsinheritsconforms toextextextext \ No newline at end of file diff --git a/.assets/extensionExamples/.stage2/HideExtensions.txt b/.assets/extensionExamples/.stage2/HideExtensions.txt index dd44ff5..d1ee01a 100644 --- a/.assets/extensionExamples/.stage2/HideExtensions.txt +++ b/.assets/extensionExamples/.stage2/HideExtensions.txt @@ -12,6 +12,6 @@ class "aClass" as aClass << (C, DarkSeaGreen) >> { ~computedProperty : String ~aFunction() } -aProtocol <|.. aClass : confirms to +aProtocol <|.. aClass : conforms to @enduml diff --git a/.assets/extensionExamples/.stage2/MergeExtensions.txt b/.assets/extensionExamples/.stage2/MergeExtensions.txt index 6a20880..6d89796 100644 --- a/.assets/extensionExamples/.stage2/MergeExtensions.txt +++ b/.assets/extensionExamples/.stage2/MergeExtensions.txt @@ -15,6 +15,6 @@ class "aClass" as aClass << (C, DarkSeaGreen) >> { ~anotherComputedProperty : String <&bolt> ~anotherFunction() <&bolt> } -aProtocol <|.. aClass : confirms to +aProtocol <|.. aClass : conforms to @enduml diff --git a/.assets/extensionExamples/.stage2/ShowExtensions.txt b/.assets/extensionExamples/.stage2/ShowExtensions.txt index 8f199eb..62b2b9d 100644 --- a/.assets/extensionExamples/.stage2/ShowExtensions.txt +++ b/.assets/extensionExamples/.stage2/ShowExtensions.txt @@ -19,7 +19,7 @@ class "aClass" as aClass1 << (X, Orchid) extension >> { ~anotherComputedProperty : String ~anotherFunction() } -aProtocol <|.. aClass : confirms to +aProtocol <|.. aClass : conforms to aProtocol <.. aProtocol0 : ext aClass <.. aClass1 : ext @enduml diff --git a/.assets/extensionExamples/HideExtensions.svg b/.assets/extensionExamples/HideExtensions.svg index cbe0fde..f892c75 100644 --- a/.assets/extensionExamples/HideExtensions.svg +++ b/.assets/extensionExamples/HideExtensions.svg @@ -1 +1 @@ -«protocol»aProtocolaProtFunction()aClasscomputedProperty : StringaFunction()confirms to \ No newline at end of file +«protocol»aProtocolaProtFunction()aClasscomputedProperty : StringaFunction()conforms to \ No newline at end of file diff --git a/.assets/extensionExamples/MergeExtensions.svg b/.assets/extensionExamples/MergeExtensions.svg index ed20764..aa27b52 100644 --- a/.assets/extensionExamples/MergeExtensions.svg +++ b/.assets/extensionExamples/MergeExtensions.svg @@ -1 +1 @@ -«protocol»aProtocolaProtFunction()aProtFunction()aClasscomputedProperty : StringanotherComputedProperty : StringaFunction()anotherFunction()confirms to \ No newline at end of file +«protocol»aProtocolaProtFunction()aProtFunction()aClasscomputedProperty : StringanotherComputedProperty : StringaFunction()anotherFunction()conforms to \ No newline at end of file diff --git a/.assets/extensionExamples/ShowExtensions.svg b/.assets/extensionExamples/ShowExtensions.svg index f3801bc..11036b9 100644 --- a/.assets/extensionExamples/ShowExtensions.svg +++ b/.assets/extensionExamples/ShowExtensions.svg @@ -1 +1 @@ -«protocol»aProtocolaProtFunction()aClasscomputedProperty : StringaFunction()«extension»aProtocolaProtFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()confirms toextext \ No newline at end of file +«protocol»aProtocolaProtFunction()aClasscomputedProperty : StringaFunction()«extension»aProtocolaProtFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()conforms toextext \ No newline at end of file diff --git a/.assets/themingExamples/amiga.svg b/.assets/themingExamples/amiga.svg index 33dbc11..3b85753 100644 --- a/.assets/themingExamples/amiga.svg +++ b/.assets/themingExamples/amiga.svg @@ -1 +1 @@ -«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconfirms toext \ No newline at end of file +«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconforms toext \ No newline at end of file diff --git a/.assets/themingExamples/carbon-gray.svg b/.assets/themingExamples/carbon-gray.svg index e90ed1f..eb76816 100644 --- a/.assets/themingExamples/carbon-gray.svg +++ b/.assets/themingExamples/carbon-gray.svg @@ -1 +1 @@ -«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconfirms toext \ No newline at end of file +«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconforms toext \ No newline at end of file diff --git a/.assets/themingExamples/cloudscape-design.svg b/.assets/themingExamples/cloudscape-design.svg index 223b772..37a2b82 100644 --- a/.assets/themingExamples/cloudscape-design.svg +++ b/.assets/themingExamples/cloudscape-design.svg @@ -1 +1 @@ -«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconfirms toext \ No newline at end of file +«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconforms toext \ No newline at end of file diff --git a/.assets/themingExamples/default.svg b/.assets/themingExamples/default.svg index 4bb49a0..71ebebe 100644 --- a/.assets/themingExamples/default.svg +++ b/.assets/themingExamples/default.svg @@ -1 +1 @@ -«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconfirms toext \ No newline at end of file +«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconforms toext \ No newline at end of file diff --git a/.assets/themingExamples/mars.svg b/.assets/themingExamples/mars.svg index bb1eb73..2704ed7 100644 --- a/.assets/themingExamples/mars.svg +++ b/.assets/themingExamples/mars.svg @@ -1 +1 @@ -«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconfirms toext \ No newline at end of file +«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconforms toext \ No newline at end of file diff --git a/.assets/themingExamples/minty.svg b/.assets/themingExamples/minty.svg index b8943fb..6309d9e 100644 --- a/.assets/themingExamples/minty.svg +++ b/.assets/themingExamples/minty.svg @@ -1 +1 @@ -«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconfirms toext \ No newline at end of file +«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconforms toext \ No newline at end of file diff --git a/.assets/themingExamples/plain.svg b/.assets/themingExamples/plain.svg index a3b36c3..7ec033a 100644 --- a/.assets/themingExamples/plain.svg +++ b/.assets/themingExamples/plain.svg @@ -1 +1 @@ -«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconfirms toext \ No newline at end of file +«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconforms toext \ No newline at end of file diff --git a/.assets/themingExamples/reddress-darkblue.svg b/.assets/themingExamples/reddress-darkblue.svg index 5684448..08333ed 100644 --- a/.assets/themingExamples/reddress-darkblue.svg +++ b/.assets/themingExamples/reddress-darkblue.svg @@ -1 +1 @@ -«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconfirms toext \ No newline at end of file +«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconforms toext \ No newline at end of file diff --git a/.assets/themingExamples/reddress-lightblue.svg b/.assets/themingExamples/reddress-lightblue.svg index 012f7b7..e25370b 100644 --- a/.assets/themingExamples/reddress-lightblue.svg +++ b/.assets/themingExamples/reddress-lightblue.svg @@ -1 +1 @@ -«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconfirms toext \ No newline at end of file +«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconforms toext \ No newline at end of file diff --git a/.assets/themingExamples/sketchy-outline.svg b/.assets/themingExamples/sketchy-outline.svg index cf6f4e7..1ffeb54 100644 --- a/.assets/themingExamples/sketchy-outline.svg +++ b/.assets/themingExamples/sketchy-outline.svg @@ -1 +1 @@ -«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconfirms toext \ No newline at end of file +«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconforms toext \ No newline at end of file diff --git a/.assets/themingExamples/sketchy.svg b/.assets/themingExamples/sketchy.svg index 20d8741..c95efc0 100644 --- a/.assets/themingExamples/sketchy.svg +++ b/.assets/themingExamples/sketchy.svg @@ -1 +1 @@ -«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconfirms toext \ No newline at end of file +«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconforms toext \ No newline at end of file diff --git a/.assets/themingExamples/skinrose.svg b/.assets/themingExamples/skinrose.svg index 908da11..46ba14a 100644 --- a/.assets/themingExamples/skinrose.svg +++ b/.assets/themingExamples/skinrose.svg @@ -1 +1 @@ -«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconfirms toext \ No newline at end of file +«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconforms toext \ No newline at end of file diff --git a/.assets/themingExamples/toy.svg b/.assets/themingExamples/toy.svg index ea6780c..1b12752 100644 --- a/.assets/themingExamples/toy.svg +++ b/.assets/themingExamples/toy.svg @@ -1 +1 @@ -«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconfirms toext \ No newline at end of file +«protocol»aProtocolaProtFunction()aSublcassaClasscomputedProperty : StringaFunction()«extension»aClassanotherComputedProperty : StringanotherFunction()inheritsconforms toext \ No newline at end of file diff --git a/Configuration/Examples/Rich/.swiftplantuml.yml b/Configuration/Examples/Rich/.swiftplantuml.yml index 4621080..e6bf00d 100644 --- a/Configuration/Examples/Rich/.swiftplantuml.yml +++ b/Configuration/Examples/Rich/.swiftplantuml.yml @@ -34,7 +34,7 @@ relationships: exclude: - "Codable" realize: - label: "confirms to" + label: "conforms to" style: lineStyle: dashed lineColor: Blue diff --git a/Configuration/Schema/json-schema-swiftplantuml.json b/Configuration/Schema/json-schema-swiftplantuml.json index e11cbb7..12c1f86 100644 --- a/Configuration/Schema/json-schema-swiftplantuml.json +++ b/Configuration/Schema/json-schema-swiftplantuml.json @@ -57,7 +57,7 @@ ] }, "realize": { - "label": "confirms to", + "label": "conforms to", "style": { "lineStyle": "dashed", "lineColor": "Blue", @@ -462,7 +462,7 @@ ] }, "realize": { - "label": "confirms to", + "label": "conforms to", "style": { "lineStyle": "dashed", "lineColor": "Blue", @@ -584,7 +584,7 @@ "description": "Struct/Class realizes protocol", "default": {}, "examples": [{ - "label": "confirms to", + "label": "conforms to", "style": { "lineStyle": "dashed", "lineColor": "Blue", @@ -598,9 +598,9 @@ "type": "string", "title": "The label schema", "description": "Label shown next to relationship arrow", - "default": "confirms to", + "default": "conforms to", "examples": [ - "confirms to" + "conforms to" ] }, "style": { diff --git a/README.md b/README.md index a229137..1fce663 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Generate UML class diagrams from swift code with this Command Line Interface (CL Use one or more Swift files as input for a diagram to visualize `class`, `struct`, `protocol`, `enum` and `extension` types with their instance and static members as well as their inheritance and implementation relationships -![Example Diagram](https://github.com/MarcoEidinger/SwiftPlantUML/raw/main/.assets/exampleDiagram.png) +![Example Diagram](https://github.com/MarcoEidinger/SwiftPlantUML/raw/main/.assets/exampleDiagram.svg)
Table of Contents (click to expand) diff --git a/Sources/SwiftPlantUMLFramework/Configuration/RelationshipOptions.swift b/Sources/SwiftPlantUMLFramework/Configuration/RelationshipOptions.swift index 7f4ab16..291ebd9 100644 --- a/Sources/SwiftPlantUMLFramework/Configuration/RelationshipOptions.swift +++ b/Sources/SwiftPlantUMLFramework/Configuration/RelationshipOptions.swift @@ -3,7 +3,7 @@ import Foundation /// Options which relationships to show and how to style them in a class diagram public struct RelationshipOptions: Codable { /// memberwise initializer - public init(inheritance: Relationship? = Relationship(label: "inherits"), realize: Relationship? = Relationship(label: "confirms to"), dependency: Relationship? = Relationship(label: "ext")) { + public init(inheritance: Relationship? = Relationship(label: "inherits"), realize: Relationship? = Relationship(label: "conforms to"), dependency: Relationship? = Relationship(label: "ext")) { self.inheritance = inheritance self.realize = realize self.dependency = dependency @@ -12,7 +12,7 @@ public struct RelationshipOptions: Codable { /// struct/class inherits from another struct/class public var inheritance: Relationship? = Relationship(label: "inherits") /// struct/class realizes protocol - public var realize: Relationship? = Relationship(label: "confirms to") + public var realize: Relationship? = Relationship(label: "conforms to") /// struct/class has exension public var dependency: Relationship? = Relationship(label: "ext") // , style: RelationshipStyle(lineStyle: .bold, lineColor: .BlueViolet, textColor: .BlueViolet)) } diff --git a/Sources/SwiftPlantUMLFramework/Internal/PlantUMLContext.swift b/Sources/SwiftPlantUMLFramework/Internal/PlantUMLContext.swift index b17c602..ddf56d5 100644 --- a/Sources/SwiftPlantUMLFramework/Internal/PlantUMLContext.swift +++ b/Sources/SwiftPlantUMLFramework/Internal/PlantUMLContext.swift @@ -32,7 +32,7 @@ class PlantUMLContext { let namedConnection = (uniqElementAndTypes[linkTo] != nil) ? "\(uniqElementAndTypes[linkTo] ?? "--ERROR--")" : "inherits" var linkTypeKey = item.name! + "LinkType" - if uniqElementAndTypes[linkTo] == "confirms to" { + if uniqElementAndTypes[linkTo] == "conforms to" { linkTypeKey = linkTo + "LinkType" } @@ -55,7 +55,7 @@ class PlantUMLContext { func relationshipLabel(for name: String) -> String? { if name == "inherits" { return configuration.relationships.inheritance?.label - } else if name == "confirms to" { + } else if name == "conforms to" { return configuration.relationships.realize?.label } else if name == "ext" { return configuration.relationships.dependency?.label @@ -67,7 +67,7 @@ class PlantUMLContext { func relationshipStyle(for name: String) -> RelationshipStyle? { if name == "inherits" { return configuration.relationships.inheritance?.style - } else if name == "confirms to" { + } else if name == "conforms to" { return configuration.relationships.realize?.style } else if name == "ext" { return configuration.relationships.dependency?.style @@ -99,7 +99,7 @@ class PlantUMLContext { if relationship == "inherits" { uniqElementAndTypes[linkTypeKey] = linkTypeInheritance - } else if relationship == "confirms to" { + } else if relationship == "conforms to" { uniqElementAndTypes[linkTypeKey] = linkTypeRealize } else if relationship == "ext" { uniqElementAndTypes[linkTypeKey] = linkTypeDependency diff --git a/Sources/SwiftPlantUMLFramework/Internal/SyntaxStructure+PlantUML.swift b/Sources/SwiftPlantUMLFramework/Internal/SyntaxStructure+PlantUML.swift index b245ce6..dcdc4de 100644 --- a/Sources/SwiftPlantUMLFramework/Internal/SyntaxStructure+PlantUML.swift +++ b/Sources/SwiftPlantUMLFramework/Internal/SyntaxStructure+PlantUML.swift @@ -24,7 +24,7 @@ extension SyntaxStructure { case ElementKind.enum: textualRepresentation = "class \"\(name!)\" as \(context.uniqName(item: self, relationship: ""))\(generics ?? "") \(context.configuration.stereotypes.enum?.plantuml ?? Stereotype.enum.plantuml) { \(members(context: context)) \n}" case ElementKind.protocol: - textualRepresentation = "class \"\(name!)\" as \(context.uniqName(item: self, relationship: "confirms to"))\(generics ?? "") \(context.configuration.stereotypes.protocol?.plantuml ?? Stereotype.protocol.plantuml) { \(members(context: context)) \n}" + textualRepresentation = "class \"\(name!)\" as \(context.uniqName(item: self, relationship: "conforms to"))\(generics ?? "") \(context.configuration.stereotypes.protocol?.plantuml ?? Stereotype.protocol.plantuml) { \(members(context: context)) \n}" default: Logger.shared.error("not supported") return nil diff --git a/Tests/SwiftPlantUMLFrameworkTests/TestData/ProjectMock/customConfigValid.yml b/Tests/SwiftPlantUMLFrameworkTests/TestData/ProjectMock/customConfigValid.yml index d70edec..7293a6b 100644 --- a/Tests/SwiftPlantUMLFrameworkTests/TestData/ProjectMock/customConfigValid.yml +++ b/Tests/SwiftPlantUMLFrameworkTests/TestData/ProjectMock/customConfigValid.yml @@ -29,7 +29,7 @@ relationships: exclude: - "Codable" realize: - label: "confirms to" + label: "conforms to" style: lineStyle: dashed lineColor: Blue diff --git a/Tests/SwiftPlantUMLFrameworkTests/TestData/basicsAsPlantUML.txt b/Tests/SwiftPlantUMLFrameworkTests/TestData/basicsAsPlantUML.txt index bd40f74..f75fdce 100644 --- a/Tests/SwiftPlantUMLFrameworkTests/TestData/basicsAsPlantUML.txt +++ b/Tests/SwiftPlantUMLFrameworkTests/TestData/basicsAsPlantUML.txt @@ -74,7 +74,7 @@ class "anInternalStruct" as anInternalStruct3 << (X, Orchid) extension >> { } aClass <|-- anInternalSubClass : inherits aPrivateGenericClass <|-- aPrivateGenericSubClass : inherits -aProtocol <|.. aPublicStruct : confirms to +aProtocol <|.. aPublicStruct : conforms to aPublicStruct <.. aPublicStruct0 : ext aPublicStruct <.. aPublicStruct1 : ext anInternalStruct <.. anInternalStruct2 : ext