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.
Related
I think I just must be stupid.
I'm having a lot trouble understanding very basic things concerning frameworks in Xcode/iOs/Swift. While I've certainly gotten some things to work, I've gotten more and more confused about what I'm actually doing. And the documentation on the web just confuses me more.
When I see discussions about how to import particular frameworks (e.g. https://github.com/danielgindi/Charts is the library I'm playing with, but I've seen this pattern repeated in other libraries) they seem to always tell me include the Xcode project file as a child project of my project, in addition to linking things as an embedded binary. This confuses me. Is it not possible to link an already compiled framework to my project without including all the source code of the project?
That is, can't I just take a library.framework file, and add it to my embedded libraries list and be done with it?
In the frameworks I've played with (again https://github.com/danielgindi/Charts is my primary example, but this is true in many others I've played with) I can't seem to use the framework without Carthage or CocoaPods. For me at this stage, that is just confusing... I accept that they are useful tools to automate a difficult process, but I'd really like to understand what that process actually is before I let a tool automate it for me. As I search the web I just seem to always be led back to these tools as being the correct way to do things.
So here are my questions.
If I find a framework library on the web... do I need its source code or can I somehow just link to a compiled version of the framework?
In my reading, it seems that libraries made with Swift are somehow second-class citizens because Swift is a newer thing. Is that still the case? (The articles I read about this seems to date from 2014-2015).
Is there are good place to understand how Apple expects me to add a framework to a project, without using CocoaPods or Carthage?
No need to add source code. Just add the framework to Target ->
General -> Linked Framework and Libraries -> Tap on + and select
your framework.
In my opinion, many new libraries are being written is Swift. So you won't be left behind for using swift.
Apple has documentation about adding frameworks to XCode. But I would suggest to use Cocoapods , as its easy to manage libraries.
Cheers :)
I'm new to programming and I've not understood if I can use RoR in X code or if I can only program throw Swift.
It´s perfectly possible to program Ruby in XCode of course,
You can use the built in git support, .rb files will be automatically recognised for being ruby, you will have syntax highlighting and auto completion (just tested it). You can make use of the project features too, managing multiple source files etc.
Just in case: Source type can be adjusted e.g. in the right sidebar 2nd dropdown named "Type".
I use xcode for c++, python and embedded development. It´s very customisable.
If I create an Xcode project with the iOS Single View Application template and choose Swift for the language, will the compiler exclude from the release build (binary) functions that never get called?
I'm wondering because I want to include a third-party library that has a lot of superfluous classes & functions, and I want to keep my app small & fast.
While I agree with comments, it is unlikely to impact performance in any significant way even if it was included...
Xcode 6 uses Apple LLVM Compiler Version 6.1, depending on how closely related it is to LLVM Developer Group's version the optimization feature is available http://llvm.org/docs/Passes.html with options such as -dce: Dead Code Elimination, -adce: Aggressive Dead Code Elimination.
One way to know for sure what is included is checking the assembly output using -emit-assembly option in the swift compiler and review the output, or opening the binary in a disassembler such as Hopper ( http://www.hopperapp.com/download.html )
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)
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.