Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

xcode

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?

like image 658
Jan Hettich Avatar asked May 11 '26 14:05

Jan Hettich


2 Answers

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.

like image 96
Alex Reynolds Avatar answered May 13 '26 10:05

Alex Reynolds


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

like image 20
buley Avatar answered May 13 '26 09:05

buley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!