WWDC2003 Session 303
Transcript
Kind: captions Language: en good afternoon welcome to session 303 so on Monday you saw intro to Xcode yesterday you saw a little bit more detail about it and today we're going to get into a lot more detail so I hope you ready so I'm Andres portal rude and I like to talk about some of the details of Xcode what we're going to talk about today some of the things we'll cover are moving to Xcode some of you may have source code so we're going to have old project builder projects you may have code where your projects you may want to move that into Xcode we're going to talk about optimizing build performance as you know the speed is a big theme of the Xcode discussion Xcode talks from this this conference and we're going to be going into some of that we're going to talk about Xcode support for building for multiple OS versions from one in the same install and also get into some issues of workflow and automation we have several features for accessing documentation for doing source code management for automating your workflow in many ways and the common theme among all of these things is time right this is all to save you time so that you can focus on your app and fixing your bugs and then shipping your product so moving into Xcode there are some ways and it's easy to get started many of you have probably already installed the Developer Preview for Panther and maybe played with Xcode maybe installed it on Jaguar there are many migration paths if you already have code one of them is to create a new project using the new project wizard of the appropriate type application framework whatever your product is and then just add the source code that you have to the project another way is to open an old project builder project Xcode can seamlessly open project builder projects and build your targets whatever you had in the project builder project of course you can't make modifications that rely on Xcode only features and then go back to project builder so but you can upgrade also we have a code warrior importer project builder had this as well but in Xcode it's been improved a lot so we can bring in your source files we convert your targets and set a lot of the compiler options as well and finally a fourth way is if you have a make file you can actually wrap an Xcode project around that you just set up a target to invoke your make file and you can still take advantage of the editor you take advantage of a lot of the features in Xcode but you would let you make file or ant or jam or whatever you're using actually do the build so another important point is that if you bring in source code let's say you bring in an old project builder project you can actually convert each target individually and we'll see how to do that but you you can leave the targets that work best as Jam targets for now you can take one target after another and convert them and then gradually start taking advantage of Xcode features and an important point is that some of the features for showing such as zero Lang can fix and continue are really only available for Xcode targets we really rely on this new native internal build system to deal with this so you need to upgrade your targets convert your targets to take advantage of that and if you create a new project or if you start with the samples the new project templates are native targets by default so let's talk a little bit about some of the target types that that Xcode supports so first of all of course the native Xcode targets we talked about we support applications frameworks libraries plugins in the developer preview and we'll be extending this to all the different kinds of things you want to build the kernel extensions etc the project builder targets you would still leave it as a project builder target if it's one of the few things we don't support yet which are the kernel extensions some of the Java types and of course you could leave your applications and frameworks as the old project builder targets as well but then you wouldn't take advantage of the new features so you'd want to upgrade and it's important to note we actually support external targets as well so you could have any external build system you want in fact it might not even be a build system at all maybe it's just a shell script you want to invoke is part of your build and it fits seamlessly into Xcode so you can have a native application target that depends on some custom shell script that you have another important aspect of an Xcode project are the build settings so the targets define what you want to build and the settings are the little knobs and switches on that it defines how you want it built so they control the inner workings of a build do you want debug symbols or not you want optimization or not where do you want the output file to go that kind of thing they're usually set on a particular target you've probably seen this in some of the earlier demos we're gonna get into more detail about that in a demo in this session and you can also though set them on a build style we call it build style so you can for example set up a build style for debug and another one for release you only need to have a single target for whatever you're building it's a it's an application but you can apply the different styles to build different variations so the Styles encode the the things that are different between a debug and a release builds such as optimization level debug symbols those kinds of things and the settings and the build styles do override the ones at a lower level we'll see a diagram here of how this fits together but the basic point is if you have a build style that says it turns on optimization then that's going to override what your target says they're also passed in the environment for external shell scripts and for external tools and this means that you can set options in your project and have those be passed down to whatever a build system or tool that you're using whether it's make whether it's a custom perl script perl script things like that so how do these fit together well as I mentioned there's there's an ordering of them and this is just kind of give you a flavor for some of the some of the depth here of what you can set up the environment variables such as path and user and those kinds of UNIX II things are available at the lowest level just like for make above that there are built-in settings these are the defaults things like where the default system locations for frameworks go the default optimization level for a compiler that kind of thing the target settings are above that this is what you see in the inspector as we'll see in a demo in a little bit and the build Styles override that so this is where you would say turn on or off debug symbols for a particular for a particular build the command line settings go above this these are not used in the IDE but as you may know and as we'll see later there is a external command line tool that lets you build Xcode projects as part of a nightly build there's part of a part of an automated process so if you pass anything on the command line just like would make it will override whatever your project said so build styles what are they what are they use for Willie it's important to note that they dynamically override the target settings they don't actually go and modify the target so this is this is something that you pick in a pop-up menu or you can choose it as the active build style and it's it's just to avoid having to duplicate targets because then you get into a situation where when you add a file you're gonna have to remember to add it to both your debug and release target etc some examples of this are you know the obvious ones turn debug symbols on or off but also you may want to enable or disable zero link zero link is a feature that saves you a lot of time but it also defers some potential link errors to the actual runtime so if you know a zero link works it actually works by doing the linking as you load in each object file you actually run the object files and when that happens if you have an undefined symbol you may not find out it until later but so you may want to turn that off just to validate a build and then turn it back on to get the speed benefit again other things you can do are to enable or disable alter alternate algorithms or if you have a demo version of your app you may want to build a demo version with a save disabled and then you build the full version also without having to add two separate targets one of the new features in Xcode compared to the the older IDs there Apple has had are user configurable build rules in a in a graphical way so you can actually define how the build system Maps particular file types to compilers in a very detail way and the way this works is that there is a list of rules as we'll see a little bit and a little bit later and the first one that matches is the one that gets applied so you can define both specific and general rules and have the specific ones first and then in that way you can control very into a very fine-grained level how you source files get processed in each rule can match two to two different things it can either be a category of file types so extra code has a built in notion of various file types Java source files C++ files res files and M files let's say but you can also match any particular shell pattern start at HC in this case matches anything with an extension of H or C you can enter anything you want there and in Xcode you also use the rules to select the compiler version so it's pretty easy to just go in and find the entries for the C files you can pick between GCC 3-3 or GCC 3-1 let's say so now you've moved you project into Xcode whether it's from project builder or by adding sources that you had separately let's talk a little bit optimistic or Minh now Xcode does have a fast powerful build system and it provides a lot of the speed benefits automatically so there's no dependency on external builds we don't generate some text file that then escaparse by an external tool instead Xcode just keeps track of the text changes that you make and use source code or whether you add files to your project and it automatically knows what you need to rebuild so by the time you go to actually start a build it's already done a lot of the work it's tightly integrated with the user interface so you see checkmarks for files that are out of date etc however there are still opportunities for you to tune your project Xcode will automatically do things like predictive compilation but you can also set up a precompiled prefix header for your project that can save a lot of time that's something that Xcode doesn't really do for you because it depends on how your sources are laid out you'll wanted to find that yourself you can also turn on parallel distributed builds parallel builds are on by default by distributed builds we want to you can access that an easy way but you need to enable that because we don't want to start sending your source code everywhere just without you knowing it zero link is something that is also enabled by default of course you don't want that on for deployments so there's fine grained control over that and the same for fixing continue so a word about precompiled headers as you may have heard in previous talks GCC 3-3 has a new precompiled header mechanism called PCH and this is a lot better than the older ones because it supports c++ first and foremost and it's also a better implementation these are easy to setup using Xcode target inspector what you do is you define a prefix header for the common API a lot of Carbon applications for example we'd start by including the carbon carbon dodge header similarly cocoa apps may start by including cocoa H so if you put this in a prefix header recompile the prefix header you can get really fast turnaround keep in mind the prefix header gets included for all files in the target so if you have C++ and C files it needs to be compatible with both this is easy to do with the pound if def we'll see that in the demo and also keep in mind to only put headers that change relatively infrequently into the PCH because of course if they change then the precompiled header will need to be recompiled now Xcode knows about all the dependencies and the inclusions so it will automatically recompile it with a prefix setter for you but that still takes extra time so you wouldn't want to put anything in there the changes a lot distributive builds is another new feature that we're really excited about Xcode can take advantage of multiple processors in your machine of course but you know your neighbor has in the cubicle next to you as that g5 sitting there and he's surfing the web and yeah you really want to compile on that machine actually so what you can do is you can take advantage of in effect and and instead of a two processor system you can have an end processor system right where n is the sum of all the CPUs and all the different machines that you choose for distributed builds so it can be distributed to other machines and there's two modes there's what we call in sort of the free love mode which is where it uses rendezvous to just see oh is there anybody out there who said that they want to be a distributed build server and if so okay well we'll send them our files right but for a more controlled environment you may want to specify a list of servers for example the ones that are known to be you know in your team's department in a lab somewhere or something and a note about this is it does require GCC 3.3 and Xcode targets so here's another reason to upgrade to upgrade an imported project builder target to be an Xcode target zero link is another feature designed to save you time we found the link time is a significant part of the turnaround time and not so much for a full build but when you do the Edit debug build cycle you spend a lot of time watching it's a linking this and that so zero link takes advantage of the fact that typically when you make edits you edit let's say you have a hundred files you added a couple of them and then you want to link again well then it has to read all those files back and generate the binary etc so what we'd rather do is just leave those other 98 files alone just load them off of the disk when the application starts running so again it eliminates the link step by running directly and this is on by default and the deploy in in the development build style so while you're doing day-to-day development you get zero link by default for for a native target the deployment build of course you get a real binary because you don't want to actually ship your object files with fixing continue this is another feature that's mostly automatic it lets you fix things while you're debugging and as we've seen in some of the previous demos you don't even have to stop at a breakpoint and for simple logic errors this can be a real time-saver it's enabled by default you can turn this one off too if you want there's no real reason to turn it off but we want to give you lots of control over these things and with that nifty search field now in the inspector there's no real reason not to this is great for localized changes you don't want to change things that have global effect like the size of the struct but logic errors off-by-one errors that kind of thing works great so I'm gonna have Scott took her to come up on stage and demo some of these things what I'm going to go through today is we've already gone through this in previous sessions but we want to take another pass through the target settings and give you kind of a deeper feel for how to set up your target both just the settings you want to set and also some tips and tricks for the precompiled headers how to set that up properly we'll also look a little bit at the build styles and how and at build feedback a little bit more in depth on that so let me bring up my project so the first thing I want to do is just point out that the way it works is that we just bring up the inspector on the target and therefore there are four parts to this inspector there's this general tab where you have your name of the target and the product and notice the name of your target can be different than the product and also the target dependencies this target doesn't have any at this point there's the build tab which I'll get back to later in just a bit and this is kind of a meet this is where all the settings go there's also the rules that was talked about earlier this is where you can set for a given type of file you know what do you want to use and as point out you can also create your own and you can reorder them how you like and then finally there's the properties so for those applications that are for those targets that produce bundles like applications and frameworks here's where you can set stuff that would normally go in your info.plist like your bundle identifier an icon or document types in the case of an application and I just note that we also do support for example opening up the info.plist as a file so you can directly edit it but let me jump back here to build and as I said this is the meat of the target inspector this is where all your settings are so you'll notice here we're looking at the common settings these are settings we expect you to change often there are things like okay I want to enable C++ exceptions or I want maybe I have a style of library or my header search paths but there's much more than this just open this up we actually have several groups here many are static but there's actually one dynamic group that I'll get to in a second so you'll notice here we have kind of our standard build settings these are settings that aren't bound to a given compiler like GCC or a tool like res they may apply to multiple tools or they may just be something that's specific to Xcode itself we also have GCC settings and we have some resource manager settings and then for these groups we also provide some subdivisions and as you can see we also show the subdivisions in some cases by different icons next to the warnings I'm next to the settings to talk let's talk a little bit more about the actual UI itself so let me go back to the common settings and you'll notice here what we provide if I if I select one of these guides we actually provide descriptions because one thing we noticed when we looked at environments is that especially when dealing with things like GCC but also other environments sometimes the settings could be very cryptic and you as a developer may not understand Oh or really need to know what all these know what all these things mean and so we wanted to provide descriptions to make it easy for you to get a little bit of background on okay if I check this on what is it going to do to my code also as you can see especially with if I go to for example the GCC settings there are quite a number of them and so we wanted to provide a quick way that you could get to the gist the settings you want even if you didn't know exactly what it was called so for example if I want to find out about let's say prefix files I can say prefix now it's interesting you'll notice here okay well this has prefixed this has prefix but effective C++ violations what's going on there well if I click on it and if you go through here what you'll find out is it's actually referencing the prefix in the description so this isn't the best example but another example is for example if I wanted to do something with type ID which has to do with our TTI it actually picks it up right here so this way you don't have to know what exactly what it's called you just have to kind of know what you're looking for so we hope that this will make it a lot e we believe this will make it a lot easier for people when they need to set those types of target settings the one last thing I want to talk about was this current settings you'll notice that it has the same kind of icon as some of our smart groups over here have because it's actually a smart group what the current settings contains is all those settings that you've set on your target that are different from the defaults so it's kind of like it's a very convenient filter because if you went to go back look at common settings or the GCC settings you'd see a bunch of things but some of these may be things you've never touched and never want to touch these are the actual settings that you have changed from the default so it gives you a quick look to see you okay what's different about my target from what a default stock target would give me so at this point I'm going to close this and I want to talk a little bit about build styles which was talked about earlier one of the problems were trying to solve with build styles is that you want to be able to just override one thing in your target and we've seen some environments where you'll have to have like you know three different version three different targets that all build the same exact thing except maybe they have a different optimization style so what we've what we've implemented are these build styles and we have two by default in every project one is the development style and one is the deployment style and so you can see here it's the same UI is the target editor and I'm not going to go to that but one small thing I wanted to mention was sometimes you want to add your own custom flag build settings for whatever reason you may need to reference them in a script for example and this is very easily done by just clicking this little plus button I can just type you know my my build setting and then you can put in the value and just as easily if you want to get rid of something you just go down here and hit the minus button it goes away and then one final thing is in this project inspector where we have the build styles we also allow you to indicate for a given project you may want to build it into a separate location like we're doing here this provides some cleanliness but also it can leverage our build system if you all if you build a lot of projects into a common location we can actually do some stuff to use those things together so let me close that so now let's talk with just oh just a second about the prefix file so it was mentioned earlier you can create these you know precompiled prefix header files well the way this works is if I go to the build let me search for prefix we have two settings one is the prefix header and you'll notice here it's QT underscore prefix I'd aging we just check on the pre-compiled prefix header and to show you what a common prefix header looks like let's go over here and this is my QT prefix page and you'll notice this is fairly simple remember that because your prefix is implicitly included before every file you do need to be careful because for example these are all C++ files that are being had these are all headers with C++ that are being implemented but if I always to include this say from a C file I don't want these headers to be implicitly included because it could cause problems so remember to use these guards here this if dev C++ FFC but it does provide a lot of flexibility because you can then have different sets of headers that get included for different types of files now finally let's go ahead I'm gonna build and run this to just give a little bit of talk a little bit about our build feedback well yeah well one our single file builds are really fast too you saw there for just a second it said the bill failed well one thing I can do is we have this detailed build window where I can go and I can say oh look I have I had errors while compiling this file here I have two warnings and I have a series of errors and that's one place that can go but there's actually places that are even more more common you can look at we actually have this errors and warnings smart group that if I click it pops up with a window that at the top has a list of all the errors and warnings and then even just with a keyboard I can go through this list and it'll jump me around to the various errors and warnings and if I want this in a separate window all I need to do is double click the errors and warnings and there you go there's a separate window I can just track it over there and then finally in a given file let me go to for example this warning right here this one right here you'll notice right here we have the warnings and the errors in line and if you actually click on them will show you in the status bar okay this is what the warning said so in this case they're relatively easy to fix choose turns out I forgot SMI call it in I'm just labeled something and then you can just go on your way back to Andres okay thanks Scott alright so that was just showing you where to actually set these some of these flags that we talked about in the slides earlier so I'm going to switch gears a little bit talk about billing for multiple OS releases so you now have the nice Panther preview CD in your bag well you also have the shipping Jaguar OS and you may want to deploy for 10.1 also so xcode lets you build for multiple OS releases but still be booted off for the same of one release this also saves you time of course because you don't have to set up multiple partitions and install on multiple platforms or at multiple partitions and then rerun so a typical example is you might want to run the jaguar version of Xcode but then you actually use the Panther api's Panther preview bays each target can individually specify the minimum and the maximum OS and the minimum version of the OS is the minimum that you require your customers to have to run it so features on that version will be assumed to be available now the maximum version specifies the version for which you want to take advantage of features so let's say your minimum is Jaguar your maximum is Panther you want to be able to take advantage of Panther features but you want to do so in a fail-safe way so if the feature is not available you just don't call it so and the Xcode developer preview supports ten one five it has SDKs 4 10 1 5 10 to 6 and for the Panther preview and this is the developer CD for both Jaguar and tachyon Jaguar and the api's for each OS release are packaged in an SDK so what is one of these SDKs contained well it's a folder that just has the headers and stubb libraries for that version of the OS so you actually get the same headers as you would on a install with developer packages SDKs can be added independently and removed independently they can be rather large since they contain all the headers and the sub libraries for a particular version so you can add them after the fact or you can remove them if you'd if you decide you don't need for example 10.1 and one of the things that happens when you set the minimum and maximum OS version you want to target is that special macros are set these are documented in more detail in the help pages but you can then use the macros in your code to check which which version which functions are available which functionality you can use them at runtime to check whether a particular function pointer is nil and then just not call that so this is this way you can take advantage of new features and still support older releases another thing Xcode has is what's called source tree support you may have external sources such as power plant or the Qt frameworks or others bit large source bases that are not part of your project but they're installed someplace on your machine that someplace may be different for each developer so what each developer can do is to set up just a single source tree to point to a place on disk and say ok here's where my QT sources live here's where my power plant sources live and then the project can just reference that and an access them that way the source tree can refer to the source base using either relative or absolute paths so you can nest projects inside of folders that group the source trees and the projects or you could put this the the source base an absolute place on disk this feature is used by the code warrior importer when it when it imports a project that uses for example power plant it will actually find power plant on you can set up a source street to that so you don't have to copy the sources in or carry those along or anything so we talked a little bit about build and about how to configure your project to take advantage of some of the speed improvements there such as setting up a prefix setter precompiled prefix setter we talked a little bit about the OS support we also have some workflow and automation features that you might not be aware of and that you probably haven't seen in any demos so far so some of the some of the stuff we've shown so far has been talked about in previous sessions but but the second half here are some some kind of pearls that I haven't been talked about yet source code management we managed we've mentioned a little bit in previous sessions Xcode is tightly integrated with the SCM support so we have built-in support for CBS and perforce and it's not just a menu that you pull down on you and you can access all the features there we actually show the information about the SCM state in line along with the files it's a lot more integrated and we support the day-to-day operations such as adding removing files changing files updating files that kind of stuff you can also compare you can look at the history you can open the inspector on a particular file and you can see the source code management history you can see who checked in who checked in what changes and when and you can actually select two revisions and compare them graphically in a tool called file merge some of the other things we leave to external repository management systems are creating a new repository and things like that we also have very good documentation access that's also part of productivity and speed right is getting quick access to your documentation and you know you look at this function with five arguments and you need the details of that really quickly we have API lookup which searches as you type you've seen in previous demos and they'll probably see you soon again maybe how we can quickly narrow down a large list of symbols of documentation pages for the api's macros ten as you know has a very rich set of api's in fact there are multiple sets of api's cocoa etc so you can focus on any one of those or more than one where you could search through them all and and look quickly look for what you want to find the full-text search is better for things like the the conceptual documentation where you may have a phrase or concept in mind and you may just try out a couple of phrases until you get the hits that you want so what's available in this area first of all there's help for Xcode itself right that's available from the help menu as we'll show in a minute in a minute we also have access to the full documentation for carbon cocoa ioki etc all the reference documentation if you need information about a specific method or function or class it's it's just a couple of mouse clicks away Suns Java documentation is also available the Mac OS 10 man pages are available we're based on BSD and all those main pages are available right there in Xcode another another aspect is scripting and automation so the X is the documentation and you can certainly do that through let's say man on the command line you could do that through the built in the documentation support you can also use scripts to set up custom queries or that kind of thing there are several levels of automation here X code itself is scriptable project builder was not that was the the previous IDE Xcode is actually scriptable from from the ground up there is a command-line build tool also so that you can use that and your nightly builds let's say if you have batch build that occurs every night that pulls 15 projects together and builds them with special options you could do that the command-line build tool is actually linked against the same framework that the Xcode IDE uses so it has exactly the same code paths for building and all that has access to the entire build system there is a user scripts menu which is this was an MP W feature that was requested and it's been added you can add custom menu items tied to your own scripts and we also have npw inspired worksheet functionality so we'll talk a little bit more about these the script ability as I mentioned before you can actually have says to xcode's object model through AppleScript you can change target settings and multiple targets add files to targets add to projects those kinds of things you can also start and stop builds using Apple script if you want there is still I should say there is still a couple of things that are not supported some of the details for example not every property of every object but we're working on adding that because we want Apple script script ability to be a very full-featured way of accessing xcode functionality another way to automate things is to build from the command line alright so you may have a build that starts at 2 a.m. at night there's a tool called PB build this is kind of for historical reasons to provide compatibility with some scripts it's it provides access to the IDE and as I mentioned it uses the exact same IDE same exact same build system as the IDE does so you have access to all the same features you can write shell scripts for nightly builds mention that and you can tune in various things and your PB build invocation so you can specify which target or targets you want to build you could specify build styles let's say you have a full feature then a demo version and maybe a professional edition of your app you can build all three to different locations just do that iteratively and then that's the kind of batch processing you can do let's say overnight you can specify build styles override extra build settings etc there's a lot of there's actually a man page for Pb build and there's also a documentation the Xcode Xcode would help about that the script menu is something this is a feature that we got a lot of requests for people want to take a let's say Apple script Perl scripts whatever just add their own menu item and attach menu right menu cue quibble into that and then use that so we have that it's completely user configurable it's defined by construct by adding scripts to a particular location to folder and you just the name of the script is the name that shows up in the menu item there's also a command line tool that adds new menu items to X similar to how it worked npw it can actually contain any kind of script of course an Apple script but also shell script Perl or Python or anything else that you can invoke from the command line as a script you can actually create an Xcode menu item for and attach a menu key equivalent and use it and one important feature here is that all the scripts have access to the text buffers so very often what people do is they will write a script to take some chunk of text manipulate it in a certain way and then paste it back into the text buffer all with one command stroke this ties in a little bit to the worksheet functionality we have this is another npw inspired feature as Ted mentioned in the overview for developer tools there's a great legacy of developer tools here we want to make sure we brought forward some of the pearls that people have really liked in the previous IDE s so xcode has npw style worksheet functionality and what this means is you have a text file you can select one or more commands and just execute them as if they were as if you typed them in a terminal like shell and one of the nice ways to use this is that you can save frequently used snippets of shell code or even Perl code or Apple script just in a text file and then run it whenever you need to it also is nice because unlike terminal it preserves the history independently so you can come back to a command and its output that you ran maybe half a year ago right and you can see what the output was you can you can compare things that way we'll see some of this in the demo and again the results here are pasted back into the text buffer so it's an iterative worksheet to experience so to help demo some of these features I'm going to ask Matt Morse to come up on stage well as unders has pointed out there's a wealth of documentation on the system there are over 500 books of various scope from small topics all the way up to the human interface guidelines and besides that there's over 75,000 bits of reference documentation for the api's that are available in the libraries on your system so this is a great wealth of documentation the challenge is to get to the piece of documentation that you need quickly so I'd like to show you some of the ways you can do that in Xcode Xcode has a documentation window well first there's help available through Xcode health and the documentation window is available also from the help menu so you bring up the documentation window it has a look very much like the project window with your groups over here in this case the groups are sections of the documentation the entire installed library and subsections that focus on particular technologies as you see as I'm selecting the different subsections the technology home page appears in the content area and from there you can go in and find the documentation you want if you want to browse in that way navigation note is you can that I think you should know is you can command click any link to bring up the separate the documentation in a separate window and you can option click to bring it up in your browser okay so that's one way to navigate through the documentation if you're browsing up here you've seen this area updating as I was clicking as well this is the results of a search for the API symbols that match that are available on your system so to focus on a particular symbol just start typing its name and you quickly go from the entire universe of 75,000 available symbols down to the few that match what you're looking at looking for and in this case let's say you were looking for the groups method and clicking that brings it up in the content area another navigation note is take a look at the symbol pop up it's just like in the code editor you can easily get around the documentation for a class using this okay I think I should mention this was shown in the overview session as well that you can turn off any of these columns titles that you don't find useful and customize it for your the way you like to get around it okay so that's the API search mechanism you can also do a full-text search as you could in project builder on any of the sections here that you have selected in your library so that's the documentation window but often the quickest way to the answer you want is directly from your code editor so let's take a look at a project bringing up some source code here getting down to something interesting you can if you want to look up the documentation for a specific symbol a class method just option click it and if there are multiple destinations as you see you get a menu to select from if you wanted to see the documentation for NS string just pick that likewise you can control click to bring up the full text search feature to search for anything that you want okay so the code editors nicely linked to the documentation axis another way you can get to documentation is through the class browser if you're doing object-oriented programming you'll probably find the class browse are very useful you can get to the header documentation or the header declarations but also the blue books give you access to the documentation for the selected class or method of that class so make use of that another way you can get around is or another type of documentation you can access is the man pages the UNIX manual pages either by name or searching so for example for example there it is and the man pages are all linked hyperlinks so you can go to related man pages this one I didn't see a link for okay so that's a good way to access those are a number of good ways to access the local documentation the documentation that's installed on your system if you want to extend your search a little further the user scripts menu that onder's mentioned can help you there for example select make a selection in your code editor and you can then search the developer website at Apple for that that selection or send it out to the internet and do a google search okay so those are some of the fast ways to get around the documentation and find answers to the questions you have let me take a little closer look at the user scripts menu okay user scripts are scripts that extend the command set of Xcode with commands that you decide you create Xcode comes with a number of pre-built commands and here they are and let me show you how some of these work very useful one eye I find is this uncomment comment selection and you see as it was pointed out earlier that there's a key equivalent for it so if you need to take some piece of your code out of service you can do it as easily as as that okay another comment type that I find very useful is this comment with a prefix with exclamation points if you need to come back to something later you can mark it in that way and with a consistent prefix you can easily get back to that sort of comments okay if you're doing object-oriented programming you might find that you're doing a lot of typing creating access or methods for your instance variables here
- user scripts can help you out
for example let's make an access or method for that instance variable okay so I've put the declaration on the clipboard and now I can just paste it in and likewise there's a similar command for pasting in the definition okay there's sort commands and one last thing I'd like to show you was the use of scripts menu is the suite of header dot commands these commands let you put structured comments in your headers that later can be generated into HTML documentation it's much like Java doc but it's for C C++ and Objective C so let's see how that works for example let's say we want to document this class it can insert a class template comment take the class name up there and here's where you'd write your abstract in description and here's a method that will document I don't know exactly what it does but we can at least put in a skeletal comment and you see that in this case the user script is smart enough to parse the Declaration and pull out the parameters here okay if we save that and view header doc for this header Xcode will invoke the header doc tool generate the HTML and create some documentation for our class [Applause] so I encourage you to give that a try okay so that's user scripts the related feature of worksheets I'd like to show right now worksheets are kind of a less formal way of adding commands to Xcode and as was pointed out it's a good way to keep a history of commands that you find useful that are difficult to retype are easily forgotten so here's just a simple command hit ctrl R select it hit ctrl R and it's executed in that text buffer and that's the output so we just did a listing unix listing of the root directory this command is used to invoke an application in a way to see if it's doing any redundant drawing and those command line switches are good to remember one way to do it is to leave it in your worksheet so let's see what that looks like so I'm invoking TextEdit and with those special flags that show where the drawing is happening and this makes it easy to see if any excess drawing is is going on thank you all right this is a command that lets you know what symbols you're importing from a particular library in this case we're going to look at text at it and see what it's pulling in from the cocoa library so command R ctrl R and there you have it and I'd like to show you just one more as we look through this list of commands you see some summer and Perl some are invoking Apple scripts some were Unix commands here's one that as a genetic engineer you might want to use if you've misplaced a patch of DNA and you need a little bit more so there you go this are the features of works worksheets user scripts and documentation access thank you thanks Matt alright so as you see this you can really go to town and customize this and just pretty much set up any kind of workflow you want bind it to a key command so I just want to wrap up some of the things we talked about we want to leave you a fairly long Q&A session here today because this is a fairly detailed session so some of the things we touched on or Xcode has a lot of productivity features right some of them we tried to make many of them work automatically and a lot of them worked pretty well automatically we're still a Developer Preview so by GM we want to get them to work a lot better automatically there's still room for improvement in terms of your fine-tuning things like fixing continue we can work on making that even better other things you really need to customize like the script ability here we provide you with a lot of sample scripts all those scripts under the user menu come as sample scripts but of course you can you can add or modify any of them this header doc knowledge for example is not built into Xcode in any way that's just in the script so you could really add whatever you want precompiled headers we talked a little bit about how to set those up there's a lot more information in the help pages Xcode gives you the power of the flexibility here to really customize your workflow the way you want to so I have to learn more about this well we're not going to ask you to go out on the web to read about this right we have built-in help pages so as we just saw you can use the documentation search fee search features not just for the API documentation but also for help about Xcode functionality itself there of course the inside macro is ten books especially the system overview book that talks more about some of the concepts that underlie this the IDE of course supports the platform initiatives things like frameworks things like like that that kind of concept and those IDE independent things are documented in the system overview Xcode knows how to build them but but the great the best documentation is in the system overview of course the developer connection tools pages and the CVS documentation and the perforce documentation are available on the web I would contact for more information guide fuji georgie technology manager for development tools I'm actually going to invite him up on the stage now for Q&A and here also some other other URLs there are a couple more sessions you don't want to check out you