Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

1458279

Suspended
Original poster
May 1, 2010
1,601
1,521
California
I see there are some code analyzers, but I'm looking for something that will show class structures.

The ones I see don't seem to offer that and with how long ObjC has been around, I would think someone has written one.

Given the one that Xcode offers, it should be pretty simple, and I've seen this in other langs.
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,560
6,059
It's never occurred to me before that it should be automated... Whenever I've wanted that I've just done it by hand. Normally I do it before I even start writing code - I plan out what my class structures will look like.
 

chown33

Moderator
Staff member
Aug 9, 2009
10,750
8,422
A sea of green
I googled class diagram objective-c

Two of the first 3 results from Stack Overflow looked pretty good:
http://stackoverflow.com/questions/...y-generate-uml-diagrams-from-objective-c-code
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.


http://stackoverflow.com/questions/2424362/create-class-diagram-from-already-existent-iphone-code
Yes, you can use Doxygen:

Install Doxygen (with MacPorts: sudo port install doxygen).

Get a script like this and change the first lines to match your configuration.

Download these files and edit the Doxygen file so it says HAVE_DOT=YES and UML_LOOK=YES.

It will then generate and install a docset that you can read from the documentation browser, or just right click and show contents from Finder.

Or, if you want a graph of dependencies check: https://github.com/nst/objc_dep It uses graphviz.


A little farther down on the first page of results is this:
http://autograf.sourceforge.net
AutoGraf is an automatic class diagram (UML) generator for Objective-C. Generated diagrams are rendered using Quartz with transparency, suitable for presentations or print. ...
Some of the other google results may also be useful.


If I've misunderstood what you mean by "class structures", then please explain in more detail exactly what kind of output you're looking for. Are you looking for UML? Some other kind of diagram?

If there's a picture of what you want, or a description, somewhere on the web, then post its URL.

Please describe what you intend to use the "class structures" for. If it's for documentation, say that. If it's for a presentation, then a different tool might be more suitable.


What have you tried?

If you googled, what search terms?

If you looked at other IDEs or tools, what did you look at? Be specific about their shortcomings.
 

chown33

Moderator
Staff member
Aug 9, 2009
10,750
8,422
A sea of green
I'd like to point out that you're probably googling within your bubble. Other people may get very different results from you. http://dontbubble.us

You can do the search using duckduckgo, or your search engine of choice.

My post went from the specific (the google results I got for a specific search) to the more general (what does "class structure" mean, what use the output will be applied to, and what has the OP tried). It was as much an example of how to find things, and a question for clarifying what the OP wants, as it was a list of the specific things I found.

http://mattgemmell.com/what-have-you-tried/
 

1458279

Suspended
Original poster
May 1, 2010
1,601
1,521
California
It's never occurred to me before that it should be automated... Whenever I've wanted that I've just done it by hand. Normally I do it before I even start writing code - I plan out what my class structures will look like.

This works well for classes that you create, and that probably covers quite a bit of programming.

I think what's going on here is that I'm following tutorials and they have their own way of doing things. I probably would have created these classes differently, but I want to complete these tutorials.

I personally would have made fewer classes, some like to make a bunch of classes and that can be hard to follow sometimes (esp when you didn't write the code :D).

Kinda funny, I can read my code with no problem, it's trying to get into another programmer's head that gets more challenging :D
 

1458279

Suspended
Original poster
May 1, 2010
1,601
1,521
California
So it looks like Xcode 3 had this functionality and it was removed from Xcode 4. However, it looks like there's a few older tools that might do the job.

I'm going to try AutoGraf and see if it still works, it's an older program.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.