yoshimkd/swift-auto-diagram

Feature request: Sort class hierarchy & multiple selection

Hurricane31337 opened this issue · 0 comments

Would it be possible to sort the classes on horizontal levels instead? I imagine the diagrams would be easier to read and would require less reordering afterwards. In this context, multiple selection of the ordered groups of classes could also be helpful to move around the whole (already tidy) groups by context.

Here an example of a quite untidy diagram with many dependencies to UIViewController:
image

After reordering in horizontal hierarchy levels, sorted descending by dependency count (not very strictly, just as a quick example):
image

The algorithm could be roughly: find the class with the most inheritances and place it, then place all protocols below them, then place all inherited classes below (maybe also sorted left to right by dependency count), continue until inheritance ends. Then place next unplaced class with the most inheritances randomly somewhere else on the screen (maybe below) with the same algorithm and so on.

Even if this algorithm wouldn't work on some edge cases, it would already help a lot on big projects.