UML diagram reverse engineered from iOS project [duplicate] - ios

I watched a video with xcode 3, that shows a button "Design" that displays a UML diagram, but I can't find how to do it with xcode 4.

Try Omnigraffle This has templates for UML diagrams.
If you drop an Xcode4 project file onto its dock icon, it will generate a UML diagram from that.
What it doesn't do is generate code from diagrams.

Search for "Xcode Design Tools" in Help. That will show you a tutorial that will walk you through creating a diagram.
EDIT >>>
It looks like the instructions are actually for XCode 3 and that UML Modeling was removed from XCode 4. The only modeling I could find in XCode 4 is Data Modeling: File>New>New File... and then look under 'Core Data'.
Class Modeling alternatives for Objective C
You might also want to check out Doxygen.

You can use yEd ... not the best solution and does not generate graphs as OmniGraffle can do but at least it can export in SVG and use GraphML files to store the data. (and it is fee)
http://www.yworks.com/en/products_yed_helpresources.html

This may help you but I didn't personally tested,
https://developer.apple.com/legacy/library/documentation/DeveloperTools/Conceptual/XCodeDesignTools/XCodeDesignTools.pdf
The Xcode class modeling tool helps you to explore and understand the classes in your project, whether they’re written in Objective-C, C++, Java, or a mixture of those languages. It allows you to see class relationships (subclass and superclass relationships—including support for multiple inheritance in C++), protocols (or interfaces in Java), and categories. In the diagram view, color and text coding help you to quickly distinguish between classes, categories, and protocols, and between project and framework code. The visibility (public, private, protected) of member functions and variables is shown appropriately. (If you are not familiar with any of these terms, you should consult suitable programming texts.)

Visual Paradigm can generate uml from objective c and back (haven't tried it yet, can't tell how well it does the job).

I was looking for a quick fix to the same problem as the OP here, but the solution that helped me most - generate a diagram from my existing XCode project that will show the operations in every class I select - was to use my still existing installation of XCode 3.
Remarks:
1. It's not real UML but it's still good to get/keep an overview.
2. You can export a diagram to PDF using the print-to-PDF feature available in most Mac OS X applications.
3. If you upgraded from XCode 3.2.6 to 4.x by upgrading Snow Leopard to Lion like me, you'll find your XCode 3 installation at /Developer-3.2.6/Applications/Xcode.app.

Related

Create Framework / Library / Module of Swift Objects in Xcode

I am a (very) novice iOS/Swift programmer with a basic question about moving reusable software objects to their own ... something.
I am developing three iPhone apps that present information from three distinct data sets. Those data sets contain unique information but are structurally similar. As such, the apps share some Swift classes that are identical, specifically the classes that model the data. As I continually refactor the code, I find that when I tweak a class in one app's project, I have to remember to go to the other two projects and make the same tweaks to the same classes for those apps. It's getting to be a big headache.
What I would like to do is have one class definition in its own ... something that I can share, link, import, or attach to/from each app's project. From my online research, I suspect that the ... something is a library? or maybe it's a framework? or a module? I have found all three terms are used, but I am not sure how they relate to each other.
Given that all of the software I am writing is in Swift, does Xcode support what I am trying to do? Thank you!
It seems you have the issue of needing the same Swift class in multiple projects. You could build a Framework (aka Module) for this class then copy it in to each project. This is probably the formally correct approach but it is a bit of overkill for just a single class.
Instead, you could just make the file in the Navigator panel a reference in each project to the one actual file.
You could also make a Workspace and then put each project into the workspace and just have the file at the top level (but this may introduce some build complexity).

UML class diagrams for Xcode (Swift programming)

I have created an iOS mobile application. Is there a way to generate a UML class diagram for the Swift programming language?
I have tried Omni Graffle, but it keeps saying that the project doesn't contain Objective-C interfaces. And Omni Graffle only does this for Objective-C.
I remember looking at this question a while ago and was disappointed that there wasn't any tool like this so I created one myself with the help of a colleague. It's free, it's open source, it's looking for contributors...
https://github.com/yoshimkd/swift-auto-diagram
And here's a tutorial on how to use it (don't worry it's very simple):
https://martinmitrevski.com/2016/10/12/swift-class-diagrams-and-more/
Happy diagraming :)
The answer unfortunately is: you can't do it. At least not automatically. Swift as compiler itself has enough flaws left. Leave alone some tool will be able to swallow any Swift code. Your only alternative is the good old manual way.
I know that Enterprise Architect has a possibility to define a language syntax based on BNF. But Swift is (again unfortunately) not context free. (In fact it's so context sensitive that it often swallows its own rear.) So that won't work either.
P.S.: Now that Swift is open source someone might take the opportunity to tap the compiler's output for the class interfaces. I guess that should not be too difficult, but it's a lot of work still.
Inspired by swift-auto-diagram and similar open-source tools I started to work on such utility with the goal to write it in Swift (to make contribution easier by Swift developers) and to integrate it in Xcode and the Swift ecosystem.
Xcode extension: https://github.com/MarcoEidinger/SwiftPlantUML-Xcode-Extension
You are able to generate a class diagram from selected lines of code or from a whole file displayed in Xcode. The class diagram will then be opened in your browser. There you can modify the diagram with PlantUML notation
To generate a class diagram from multiple source files you can use the underlying CLI tool and Swift Package: https://github.com/MarcoEidinger/SwiftPlantUML
There is a size limitation to the visible diagram content (but you can delete content in the browser with PlantUML notation)

Viewing class/protocol hierarchy in XCode 5

I've come to iOS from Java world, and one of the most useful features in Java is JavaDoc. It is possible to see ALL implementors of specific interface or descendants of specific class with ease. Is there something similar in XCode 5?
Yes, there are Symbol Navigator, but it shows either hierarchy of ALL classes/protocols or only project-specific classes. And what I want is to quickly find out, for example, all descendants of UIDynamicBehavior class. How to do it fast and efficent in XCode 5?
Thanks a lot in advance! :)
Actually not an answer you do want to hear, but you should try AppCode. If you're from Java world, you're probably familiar with IntelliJ IDEA, which is basically what AppCode is.
^H and ...

How do obtain a list of classes in xcode

I am developing an iOS app and would like to
obtain a list instance methods for classes in my xcode project.
Does anyone know how to do this?
Thanks
If you want this for documentation purposes (rather than just while using XCode) you can run various programs over your code to extract the details and generate documentation in various formats.
One possibility is to use Doxygen (which is fairly intense to come up to speed on, but is very good at what it does). A mini tutorial on this is shown in Documenting objective-c with Doxygen part i, Documenting objective-c with Doxygen part ii and Using the doxygen helper in xcode 4
This tutorial also mentions the Apple product HeaderDoc, and another 3rd party product (apparently no longer supported) AutoDoc, but the author prefers Doxygen (as do I)
In Xcode 3: View → Smartgroups → Symbols.
For Xcode 4 see Browse to Project Symbols.

CPAN/gem-like repository for Objective-C and Cocoa?

Is there any centralized repository of useful Objective-C / Cocoa libraries as there is for Perl, Ruby, Python, etc.?
In building my first iPhone app, I'm finding myself implementing some very basic functions that would be just a quick "gem install" away in Ruby.
There's a project for that! It's called CocoaPods!
Homepage: http://cocoapods.org/
Source: https://github.com/CocoaPods/CocoaPods
Unfortunately not :(
There are some very useful sites however. I find one of the best is cocoadev.com as it contains lots of useful information about many of the more obscure classes usually including snippets of code to do some really cool things :)
Maybe we (the cocoa community) should look into building something like this!
Oh and I just remembered this site cocoadevcentral.com which is also very good for starting out with cocoa.
Daniel mentioned http://cocoadev.com.
More specifically, check out http://www.cocoadev.com/index.pl?ObjectLibrary.
"This page is for tracking re-usable Cocoa classes that can be mixed, matched, and dropped fairly easily into existing Cocoa projects to add useful functionality."
I'd be interested in what kind of "basic functions" you're having to implement. There's actually quite a lot already there in the provided libraries, and I wonder if you're just not finding functionality that's already there...
There's a new index of reusable code for Mac OS and iOS: Cocoa Objects
I might be confused or missing something here... But doesn't apple provide all the Foundation / Cocoa / AppKit / CoreAudio / Qtkit / etc libraries that should provide all of the very basic functions you are looking for?
Other than what xcode comes with or is on the apple dev site, there are no centralized repo's for Cocoa.
Google Code also has some objective C things up. It depends on what you are looking for...
Also see GitHub, many useful Objective-C projects, especially re iPhone. See activerecord & cocoaoniguruma, for instance.
http://github.com/search?q=objective-c
http://github.com/search?q=objc
Google has Google toolbox for mac which got me started unit testing my iPhone application which was the main thing I found missing.

Resources