proactive-solutions / SwiftPlantUML-Xcode-Extension

Xcode Extension for generating class diagrams from Swift code (powered by PlantUML)

Home Page:https://github.com/MarcoEidinger/SwiftPlantUML

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SwiftPlantUML

Build Swift 5.3 Twitter

SwiftPlantUML-Xcode-Extension

Generate and view a class diagram for Swift code in Xcode with this extension.

This Source Editor Extension makes use of SwiftPlantUML Swift package. You can also use SwiftPlantUML as a command-line tool.

Features

  • 📊 Create class diagram from Swift file
  • 🔦 Create class diagram from selected Swift code

Example

SwiftPlantUML Xcode Extension - Usage Demo

Install

Homebrew

brew install swiftplantumlapp

Installation through Homebrew

Alternative

  • Download latest SwiftPlantUML package from the Releases.
  • Copy SwiftPlantUML to your Applications folder.

Enable Extension

  • Launch SwiftPlantUML.

    SwiftPlantUML user interface
  • Enable extension in System Preferences > Extensions > Xcode Source Editor > select SwiftPlantUML

    SwiftPlantUML Xcode Extension - Installation

Configure

Optional:

Preferences - Elements

Preferences - Members

Preferences - Others

Troubleshooting

The command "Open editable diagram in browser" is still busy

Xcode Source Code Extension initialization might take up ~ 30 seconds on initial launch.

If the prompt does not appear within 60 seconds

image

then check for a crash report related to XPC service in Console app of your MacOS.

CrashReportXPCServiceExample

If you see such crash report related to fatal error: Loading sourcekitd.framework/Versions/A/sourcekitd failed please check the installation path of Xcode. If it's installed under /Applications/Xcode.app, please run:

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

If it's installed elsewhere, please replace the /Applications/Xcode.app path in the command above with the location where you've installed Xcode.

Technical Details

This Source Editor Extension makes use of XPC service to run the app sandboxed and use SwiftPlantUML (and its dependency SourceKitten). Source Editor Extensions using SourceKitten (either directly or indirectly) have to either run in a non-sandboxed app (and could not be distributed via the App Store) or use XPC service to outsource the use of SourceKitten to a different process.

Acknowledgements

These awesome blog posts helped me to dive into Xcode Source Editor Extensions and XPC services

About

Xcode Extension for generating class diagrams from Swift code (powered by PlantUML)

https://github.com/MarcoEidinger/SwiftPlantUML

License:MIT License


Languages

Language:Swift 100.0%