Jan Hettich
Jan Hettich

Reputation: 9886

Xcode: How to find the source code for standard or system libraries?

Xcode question here: If I'm programming in C++ or objective-C, and I #include or #import a library; e.g.

#include <iostream>
#import <Cocoa/Cocoa.h>

I'm often not sure where to look for these header files in the directory structure on my Mac. In other development environments, you can right click the included or imported filename and have the option to jump to source. Is there an equivalent feature in Xcode?

Also, for the standard C++ libraries and the Cocoa framework, is the source code for the implementation files available, or only the headers together with compiled link libraries?

Upvotes: 3

Views: 2107

Answers (2)

buley
buley

Reputation: 29208

Holding option and double clicking on a function is a great way to see a document snippit, pictured below. You can hit the book button from there to see the whole documentation item.

But that doesn't have the source. To answer your question, what you might try is the button with the .h on it, pictured above the NSURLConnection.h box, It should pop you into the source for the file displayed in that title.

alt text

Upvotes: 2

Alex Reynolds
Alex Reynolds

Reputation: 96927

For Apple frameworks, the headers are available. You can also option-double-click on a method or selector to get to either Apple documentation or to the relevant entry in the associated header file.

Upvotes: 4

Related Questions