how can I automatically create a class diagram from Objective-C 2.0 and Xcode 5/6 - class-diagram

I have been reviewing similar questions and all answers refer me to either OmniGraffle, which is not really intended for the task, or to other tools that are not designed for Objective-C. I have found a python script that graphs dependencies through imports, but so far I have had no real luck. There are many tools for other languages, is it possible that nobody supports Objective-C? I mean, is there really not a tool that will read all .h and .m files from a project and produce a decent class diagram?

Visual paradigm is another option.
http://www.visual-paradigm.com/solution/freeumltool

Related

Class visualization tools for Objective-C?

Does anyone know of any static class/code explorer/visualisation tools for Objective-C? Something to help become familiar with large code-bases?
Thanks!
Have a look at OmniGraffle
You can drop an Xcode project file onto it and it will create a class diagram for you.
Few of options I've come across:
Scitools: https://scitools.com/index.php
Pros: Lots of features and some interesting plugins
Cons: $1000 (15 day free trial)
Combination of Graphviz (similar to OmniGraffle but free) and NST's objc_dep project (converts objective-c files into Graphviz readable file): http://www.graphviz.org/Download_macos.php and https://github.com/nst/objc_dep
Pros: Free
Cons: Not so many features
Xcode 3 and 4 differ feature-wise in this regard.
doxygen offers some cool advanced features (interactive browsing, graphs). it also works well with other languages. probably the most featured/detailed, but not integrated with the sources like an ide.
lastly, check out JetBrains' AppCode. although it's still in it's infancy as an ide for objc, what they have done for Java has been great.

GNUstep NSString.m file

I'm using GNUstep to begin with learning Objective-C.
I could find the header files for all, but don't know where to find its implementation files.
I was thinking, with that I can understand the whole programming style and many more.
I am working without mac , so if some body knows about any good tutorials , that i can use to identify structure of every Classes.
For instance, i have to parse an xml file, just to learn,
but don't know where to start.
Without IDE its hard to find out the sequence, and I don't have got access to any tutorials that best explains this, ( all that i get is in accordance with i-Phone and Cocoa. )
I'm concentrating on console programs, so that I can be thorough with the syntax and language.
Pls help me.
http://gnustep.org/ is the best resource for GNUstep related information, including source and documentation.
GNUStep has some tutorials and definitely the source code available.
You will find that there are small bits and pieces where Cocoa has moved on so GNUStep will not recognize new methods and things like properties or any new objective-2.0 stuff and so on.
Where ever you have the source installed, you can find NSString.m here
/path_to_my_src/gnustep/modules/core/base/Source/NSString.m

Free UML diagram tool for Objective C

Are there any free tools in the market which support Objective C?
I use Argo UML and Violet UML for modelling on my Mac (Assuming you are using a mac). They are not great but they work.
If you want code generation that is a whole different issue.
Actually, one of the points of UML is to be language-agnostic.
If what you're asking is if any of the available tools supports Obj-C code generation: Googling, you can find some (commercial) tools that claim to offer Objective-C code generation.
It probably makes more sense to use XCodes built-in diagramming tools, which can be found in the "Design" menu. These are not, strictly speaking UML, but are quite similar.
Also, UML might not be such a good fit for designing Cocoa / Objective-C applications, because mostly you will use Model-View-Controller, into which a UML diagram doesn't offer much additional insight.
Actually, XCode 3.2 had a class editor that did what is being asked for. In Xcode 4.0 and later we can only use it for core-data related tasks which is a shame. I have a similar need as I have a team member that prefers diagrams to code.
I don't understand why it was removed. I'm hoping that I can find it as a standalone tool within the Apple Developer member center, but I don't have high hopes.
Worst case, you can download XCode 3.2, install it alongside 4, and use the editor within 3.2.
I have tried this very briefly. So long as you don't try to open the file under 4, I think it works, though I'd be wary of opening your 4-based project in 3.2.
Hope this helps.

Cocoa/Objective-C - Can i somehow see the implementation files?

I believe i can learn thing or two if i can see the implementation files (.m files). Is there any way the i can view NSString.m or NSNumber.m files? and others? If i try to find these files using spotlight, i get nothing.
No, most (all?) of the Cocoa library implementations are only distributed in a compiled binary form. You could disassemble them, but that's probably against the Mac OS X EULA, and it also wouldn't help you understand them at all.
You could take a look at Cocotron, which is an open-source implementation of Cocoa. It won't be exactly the same, but at least for the core classes, it will be virtually identical.
Many of the basic cocoa classes, like NSString and NSNumber, are implemented in core foundation and "toll-free bridged" to objective-c classes. Core foundation is a C (not ObjC) API and the source is available as part of the Darwin open-source project.
So, to see how NSString or NSNumber is implemented under the hood, follow the link above and take a look at CFString and CFNumber, respectively (you'll need an Apple developer account, but registration is free).
Also worth looking at the mySTEP sources.
This helped me when doing something that subclassed NSMatrix some time ago.
I would guess they are already compiled into libraries.
I just did a quick check on my mac and could not find a NSString.m file as well. Are you utilizing Xcode's documentation? I find it has most everything I need.

Any ReSharper equivalent for Xcode?

I'm a complete Xcode/Objective-C/Cocoa newbie but I'm learning fast and really starting to enjoy getting to grips with a new language, platform and paradigm.
One thing is though, having been using Visual Studio with R# for so long I've kind of been spoiled with the coding tools such as refactorings and completion etc and as far as I can tell Xcode has some fairly limited built in support for this stuff.
On that note, does anyone know if any add-ins or whatever are available for the Xcode environment which add coding helpers such as automatically generating implementation skeletons from a class interface definition etc?
I suspect there aren't but I suppose it can't help to ask.
You sound as if you're looking for three major things: code templates, refactoring tools, and auto-completion.
The good news is that Xcode 3 and later come with superb auto-completion and template support. By default, you have to explicitly request completion by hitting the escape key. (This actually works in all NSTextViews; try it!) If you want to have the completions appear automatically, you can go to Preferences -> Code Sense and set the pop-up to appear automatically after a few seconds. You should find good completions for C and Objective-C code, and pretty good completions for C++.
Xcode also has a solid template/skeleton system that you can use. You can see what templates are available by default by going to Edit -> Insert Text Macro. Of course, you don't want to insert text macros with the mouse; that defeats the point. Instead, you have two options:
Back in Preferences,go to Key Bindings, and then, under Menu Key Bindings, assign a specific shortcut to macros you use often. I personally don't bother doing this, but I know plenty of great Mac devs who do
Use the CompletionPrefix. By default, nearly all of the templates have a special prefix that, if you type and then hit the escape key, will result in the template being inserted. You can use Control-/ to move between the completion fields.
You can see a full list of Xcode's default macros and their associated CompletionPrefixes at Crooked Spin.
You can also add your own macros, or modify the defaults. To do so, edit the file /Developer/Library/Xcode/Specifications/{C,HTML}.xctxtmacro. The syntax should be self-explanatory, if not terribly friendly.
Unfortunately, if you're addicted to R#, you will be disappointed by your refactoring options. Basic refactoring is provided within Xcode through the context menu or by hitting Shift-Apple-J. From there, you can extract and rename methods, promote and demote them through the class hierarchy, and a few other common operations. Unfortunately, neither Xcode nor any third-party utilities offer anything approaching Resharper, so on that front, you're currently out of luck. Thankfully, Apple has already demonstrated versions of Xcode in the works that have vastly improved refactoring capabilities, so hopefully you won't have to wait too long before the situation starts to improve.
I'm excited to say that JetBrains have decided to make a decent IDE for Objective-C coders.
It's called AppCode and it's based on their other tools like RubyMine and Resharper. It's not native Cocoa, but has loads of raw refactoring power.
http://www.jetbrains.com/objc/index.html
I've started using it for my main Objective C project and I'm already in love. It's still in it's infancy, but for code editing and refactoring it already blows Xcode away.
Update
It's now at a totally usable speed. I've switched over to it full time and it still blows my mind how amazing refactoring and coding is compared with Xcode. It just handles so much for you - auto importing, almost infinite customisation. It makes Xcode look like a toy.
Xcode has refactoring for C and Objective-C built in. Just select what you'd like to refactor, choose "Refactor..." from either the menu bar or the contextual menu, and you'll get a window including the available refactorings and a preview area.
Xcode doesn't currently have a public plug-in API; if there are specific types of plug-ins you'd like Apple to enable, file enhancement requests in the Bug Reporter. That way Apple can count and track such requests.
However, there are third-party tools like Accessorizer and mogenerator (the latest release is mogenerator 1.10) that you can use to make various development tasks faster. Accessorizer helps you create accessor methods for your classes, while mogenerator does more advanced code generation for Core Data managed object classes that are modeled using Xcode's modeling tools.
Just so people know, Accessorizer does more than just generate accessors (both 1.0 and properties for 2.0) it also generates Core Data code for persisting non-standard attributes, your NSSet accessors for custom to-many relationships.
In fact, Accessorizer will help provide you with the init, keypath, keyed-archiving, indexed accessors, accessors for unordered collections such as NSSet, copyWithZone, KVO, key-validation, singleton overrides, dealloc, setNilForKey, non-standard attribute persistence (Core Data), locking, headerdoc, convert method to selector, NSUndoManager methods and more.
I found some xtmacro files in Xcode.app package:
/Developer/Applications/Xcode.app/Contents/PlugIns/TextMacros.xctxtmacro/Contents/Resources
Installed Xcode ver. 3.2.5.