Copying Xcode samples

Posted by Jerry | Posted in Development | Posted on 18-06-2011-05-2008

0

Whenever a new version of the iOS SDK is released, one of the first things I do is copy all the sample code released with that version to it’s own directory. This allows me to browse the samples more easily and open them all from a common location without having to open them one-by-one. Here is how we do that:

1. Open Xcode preferences and choose the Documentation tab. Pick the new library and show information on it (the arrow in the lower left corner opens the info pane). Click the link for the Installed Location to open Finder to that location.

Xcode preferences

2. The file that stores the documentation for this iOS version is a docset. The one we want should be highlighted. Right-click and choose “Show Package Contents”.

Show Package Contents

3. Browse to Contents/Resources/Documents/samplecode inside the package. This is where all the code and html for help is located. Now we just need to get the code out of the folders.

Contents/Resources/Documents/samplecode

4. Search at that location for filenames containing zip. That will show you just the zip files under that directory. Then you can select all, copy to a location you choose, I use a folder under my documents directory, and then extract the zip files (use Command-O to open them with all the files selected in the new folder). Now you should have a folder tree with all the sample code there ready for you to browse. Happy coding!

search for zip and copy

Comments are closed.