How can I automatically generate UML diagrams from

2019-03-08 09:08发布

问题:

Is there a way to create automatically the UML diagram from the code, in objective-C ?

Cheers, Niels

回答1:

Have a look at doxygen. Which seem to have support for Objective-C. It might not give you an UML diagram but it is able to show references etc in graphs and with added comments you can give more information for the formatted output.

See here for an example in Objective-C, the clang project (oups, clang is actually written in C++ and works on Objective-C code) But I found this blog post about using doxygen for Objective-C code



回答2:

Same problem, still looking for answer:

  • Checked Doxygen, but I could generate only documentation and graph fragments. Maybe should spend some quality time with documentation
  • Checked OmniGraffle, output was kind of ok. Run out of free demo period and not going buy full version ONLY for a few occasional graphs. Might be ok, if you have some other uses for it. Not sure, if OmniGraffle "officially" supports that any more

Finally found "objc_dep.py" from GitHub. It's free, fast, simple and works as-is. It generates a kind of "dependency graph" based on imports, which really isn't UML or class diagrams, but was surprisingly close enough.

So that's what I'm using now, but non-actively looking for something "more". Blogged about the objc_dep tool in "Dependency Graph Tool for iOS Projects", might be interesting if you want more info with sample graphs.

...but looking for something to generate real class diagrams.



回答3:

There is no proper solution to create a UML diagram from Reverse Engineering code. I tried all the above methods including the python code. The python code though useful fails if you have a huge project, which unfortunately was my case.

Thanks Pradeep