Developer Tools • 1:00:10
Xcode 3.0 has been streamlined and enhanced with new features to make you more productive than ever before. Discover how to build, fix errors, and debug your code without ever leaving the text editor window. See how the enhanced CodeSense and new Research Assistant will help you code faster and more accurately. Discover how easy it is to make project-wide changes using refactoring, with the confidence and safety of integrated project snapshots and SCM support. Learn about these features and much more that is new in Xcode 3.0.
Speakers: Chris Espinosa, Dave Ewing, Scott Tooker, Brent Shank
Unlisted on Apple Developer site
Transcript
This transcript has potential transcription errors. We are working on an improved version.
Welcome to Xcode 3.0, The New Development Workflow. I'm Chris Espinosa, the manager of the Xcode IDE Core group.
( applause )
And we're only going to talk about one thing today. And that's the new features of Xcode that help you speed your work. Some of this content may be a repeat from last year when we debuted Xcode 3.0 at this developer conference. But we've done a lot of work in the interim to hone those features and improve them and we've added a couple new things that we're going to show you.
What you'll learn is about how configuring Xcode installations and projects so that you can be interoperable and portable between Xcode 2.0 and Xcode 3.0. We'll talk about the new editor features that help you focus on your work. You saw some of those in the Developer Tools State of the Union on Monday.
We'll talk about keeping the debug and build windows out of your way while you work using things like data tips and message bubbles. We'll talk about how you can find information and help faster. And we'll talk about keeping your work safe in sharing it with others and being able to roll back changes so that you can be more innovative.
So let's start with your development environment. How do you configure it? How do you set it up? Now historically when you've installed Xcode tools on a version of Mac OS X you get a big folder of stuff in /developer and that's your developer folder and there it is. You can't move it, you can't put it anywhere else, you can't sim link it. But now in Xcode 3.0, your Xcode 3.0 folder is self contained. Everything is in one folder.
( applause )
There's nothing in system library private frameworks anymore. We have our own copies of all the tools that we install in usr bin. So everything's in one folder, you can take that and you can put it on an external drive if you want, you can even share copies off a file server, but the best thing is when we come out with the new version of Xcode 3.0, you can put it down right next to it and switch back and forth.
( applause )
And even better, if you still have projects and are sharing work with the group that needs to use Xcode 2.0 to build for Tiger for shipping systems, but you want to run on a Leopard system, you can put Xcode 2.5 down on the same system.
( applause )
So you can install the developer folder wherever you wish, you can move and rename it as long as it remains self contained, that includes external drives, you can even put it on a, you know thumb drive, plug it in and go. You don't need to reserve space on that volume all of our caches are on the main boot drive and you can install and run separate versions of Xcode simultaneously. You can actually have Xcode 2.5 and 3.0 launched side by side with different projects building at the same time.
( applause )
Now there's some tricks to this. Every version will use its own tools so if you double click a nib with an Xcode 2.5, it'll go to Interface Builder Tiger and if you double click a nib with a Xcode 3.0 it'll launch Interface Builder 3.0.
Similarly, we use the GCC compiler from Xcode 3.0 when running it in Xcode 3.0 and we use the Tiger based GCC compiler when you're running Xcode 2.5 even on Leopard. Not all of the Xcode 2.5 tools will run on Leopard, there are some limitations. But moving forward we hope that this will really make it easy to maintain multiple versions of your development environment so you can go to a new OS without being forced to switch to a new development environment and vice versa.
Now once you're doing that you've got an issue with opening your projects, you know, what about opening a 2.4 or 2.5 project in 3.0. Won't that change the project file format so I can't go back? Is everything a trap door? Well, by default, Xcode 3.0 opens, builds and runs Xcode 2.4 projects unchanged. It will not alter them.
So you can take them back even to a Tiger machine with Xcode 2.4 or 2.5 and they will not change. It will, we made one change in Xcode 3.0, we're kind of dropping support for Xcode 1.5 and 1.2 and 1.1 and 1.0 and project builder and so forth. So if you want to upgrade old projects upgrade them in 2.4 or 2.5 on Tiger or Leopard before opening them in 3.0, but once they're in 2.4 or 2.5 format you're fine.
We have a new slice in the project inspector that shows project format and project compatibility. By default, it's set to the one that it was. If you open up existing 2.4 projects in 3.0, the project format will be 2.4 compatible. If you try to make a change in that project to adopt an Xcode 3.0 feature that will not be compatible with 2.5 or 2.4, you get an alert giving you the choice of making the change and upgrading the project format or not making the change. So you always know when you're making a change that will make your project incompatible with 2.4, you always have the choice to accept it or back out.
And if somehow somebody's added a 3.0-ism for some reason or something we didn't catch that makes it incompatible with 2.4, we'll show a warning right in the status line saying that this project says it's compatible with 2.4, but it's using 3.0 features. So you can go and know what's going on there.
So now that we've got your system configured and installed and you're up and running on Xcode 3.0, let's talk about the workflow. Now in the classic Xcode workflow you open your project in either the condensed mode, the condensed layout or the default layout which is what's here or the all in one layout and usually to do file navigation you want to show the detailed view so you can get some sorting and searching and filtering on your files.
And now already your source code's a little bit constrained and then you go to build and then you get a build window plopped down on top of your source code and then you go to debug and you get a debug window plopped down on your source code and you really want to focus on your code, but there's all this stuff in the way.
In the new workflow, we keep your source code front and center. You can just open up your document window and do your work there. When you build your errors or warnings are brought straight to the line that's causing the warning and error. You can enable them, disable them right there in the editor and when you recompile and fix them they go away without having to open a separate window. When you're debugging, we bring your debug controls right to the editor window in a small script at the top. So you have your stack back trace and your thread view and your step controls and easy access to all of your debug controls right there in the editor.
When you're debugging in the editor and you want to see the value of variables we have data tips that show you the value of variables as you hover over them even deep and nested structures so you can drill down even in very complex data structures without even clicking the mouse.
And when you want to set break points you not only can set break points right in the editor but if you open up a message bubble for the break point you can even set the conditional breakpoints right there in your source code without having to go to a separate window.
( applause )
Now when you're reading and editing code we also provide some other things that help you focus on your work. You saw the code folding, you've seen code folding in other editors before, we're not going to do that much of a demo of it because everybody knows code folding and it's well supported in Xcode 3.0 but what we do have in addition is this thing called code focus.
We use the same semantic analysis of your source code that we do to fold it to essentially give you a preview of what's going to be folded if you fold by highlighting the blocks in scope using the standard Macintosh UI technique of highlighting the thing that is enabled or in focus and then dimming back the things that are less relevant.
And you can either turn this on ad hoc by just moving into the code focus ribbon or you can leave it on all the time and just have the thing that's in scope always highlighted and everything that's out of scope always dimmed back as you type. That helps get unneeded detail out of your way.
But another important thing we've added here editing workflow is we've formalized and enhanced the built in scripting capabilities of Xcode. Now many of you have known all along that you could by dropping a secret file in a secret folder enable a secret menu in Xcode that let you execute these scripts that were written in some bizarre melange of shell scripting language with percent percent percent some random keyword identifiers in them that were mystically substituted at execution time and then did something about piping the results back. It was a little cryptic.
What we've done is we've brought user interface, we've brought scripting right into the user interface, the script menu is now enabled all the time, you can have the access to all the scripts that have been in Xcode since 1.0 and in the same scripting language but by choosing edit user scripts you also get a window that lets you create, add and edit the scripts right there in Xcode. And you have the choices of straight shell scripts, the modified shell scripts which Xcode will substitute things into the script before executing them and you can also drag-and-drop Automator actions and AppleScripts right into the window and execute them from the Xcode script menu.
So we hope that this is going to fill a missing hole in extensibility and tailorability in Xcode. People have always wanted to create their custom workflows and to tailor Xcode for their working style now you can do it with the Xcode script menu. So rather than talking about it anymore let's see some of the code focus, the code folding, the code sense and the syntax coloring the script menu and here's Dave Ewing of the Xcode team to give you a demo.
( applause )
Hi thanks Chris.
Alright, well I'm going to show you some of the features here in the text editor in Xcode 3.0 some of the new features here. To do that I'm going to use a project called Grand Perspective. You may have seen it in some of the earlier sessions. It's a tool that let's you visualize the file in folder hierarchy on your disk. You'll get to see that running a little bit later. But first we'll just bring up an editor window here. And this editor window looks a lot like what you're used to in Xcode 2.0, things are syntax colored. but I assure you underneath it's quite a bit different.
If we scroll down a little bit into the file you can see that things actually get a little bit more colorful than they were in Xcode 2.0. So for instance in this dealloc method there's an instance variable called tree balancer that's colored and the release method on that is a system class method release on NS object, of course.
So let's go ahead and look a little bit further down in the file and this file is actually unfamiliar to me, it's indented differently than I'm used to. So it's an open source project. It would be kind of rude if I went in and re-indented everything so I want to be able to look, see the block structure of the code. So what I would normally do in Xcode 2.0 is just double click on some braces that I can see those blocks highlighted but if I double click on something big and scroll around in it I really don't see any of that block structure anymore.
In Xcode 3.0, we have the notion of code focus that lets you see that block structure a little more easily. So go down into the view menu and at the bottom of the code folding menu we have an item called focus follow selection, I'll go ahead and select that. So what this does is it turns on code focus, it's on all the time now so I can click in a different block and it will highlight that block of code. And, of course, it's dynamic so as I type it actually updates as you go.
And it's accessible through the keyboard so I can turn it off if I want, hit undo. Alright, the next thing I'm going to show you briefly, link code folding is indeed something you've seen in other editors. But along the left edge here there's this bar that we call the cold folding ribbon, my mouse is moving around on me here.
And if you hover over it you can see that it highlights the block of code that it will fold and marks them with little twisty triangles there and you can click and fold away that piece of code. Click again and fold away the whole method if you like. And since it's like an outline view you can just option click to unfold everything that's underneath it.
Alright, well let's go ahead and use some code here, make this a little bit bigger. Not big enough. Well, it's been reformatted since I looked at it so anyhow. I'm going to now show you a little bit of code completion in Xcode 3.0. So Xcode has had code completion since the beginning and we've been refining it over the years, making it more accurate. We've added something new in Xcode 3.0 called automatic code folding that will show you its best guess of what you want to insert as you type. To motivate that let's just go ahead and say we want to add a new local variable here.
Another NS mutable array and you can bring up the code completion list with the escape key and that's nice it knows that the most likely thing is NS mutable array and you can hit return and have it insert it. That's pretty good. But let's go ahead and create an array.
And you can do the same thing but there should be a better way than that and there is in Xcode 3.0. So I'm going to go ahead into the preferences here and go into the code sense panel and turn on automatic suggestion. And I'm going to set it to immediate. You can have it happen after a short delay if you'd like to.
But now when I go and type it shows you its best guess of what you might want to insert immediately. If you want to accept that you just go ahead and hit tab, type an A and the most likely method you'll call is alloc, we'll go ahead and accept that as well.
You type I, it also knows that init with capacity is the most likely thing you're going to want to use which in those for a number of reasons, one of them of course you've been using it in this method already so it knows that you're more likely to call that method, but that's actually not the method I want to call. Now if I type a little bit more I get to init, it knows that init is a valid method to call so it actually takes the automatic suggestion away.
But init isn't the method I want to call either. I want to call init with contents of URL so I go ahead and type the W it puts, it's best guess in again, that shouldn't have changed certainly, it thinks that's the most likely thing, but it's done something a little bit differently here.
It knows that all of the methods that begin with init w also begin with init with and it shows that to me by selecting that portion of the text. So I can go ahead and hit type or hit tab and complete on that and start typing a little bit more and it gets to the method I want. And I'll just fill in the rest of the way. Passing nil there is probably a bad idea, you guys shouldn't do that I can do that in my demo, but you shouldn't do that.
Alright, well now let's look at a little bit more of the code down here. We have let's see there's this class directory item. I don't know what this class is, so the way to find that out you'd probably go to the source code to that, you'd command double click on it. That's certainly something you guys are very familiar with by now. But I actually want to see what the class hierarchy of that class is and there's a new way to do that in Xcode 3.0 and it's called the class navigator.
So here up in the top right of the window we have a new popup menu that shows the hierarchy of the current class that you're in. So directory item inherits from file item which inherits from item which inherits from NS object. That's not a big surprise. If you select on it, it goes right to the implementation of that class.
Okay. So the last thing I want to show you is some scripting. I did a little code completion that makes it much easier for me to type, I'm not a very good typist so that's good for me. But I actually don't like to type at all. So I have this NS log here that just doesn't stick out enough for me in the console when it comes up so I want to make it upper case.
Well I can't make it upper case in Xcode, because there's no way to do it there's no command to do that in Xcode, but there is a way to add a command. And that's in the scripts menu. And those of you that did scripting in Xcode in 2.0. Chris described a little bit of it more than I, I couldn't believe it, it's so gory, I couldn't believe he said as much as he did about it. But we have a new item, the edit user scripts menu item at the bottom, that let's you do it without all that complexity.
So I'll go ahead and bring that up here. On the left here we have a outlying view that shows you the hierarchy of the menu and we can go down inside and just go ahead and add some items to it. I'm going to add a new separator. And separators are pretty uninteresting so I'm going to go ahead and add a script below that. And text script is also pretty uninteresting I'm going to change the name of that.
So now I have a new menu item called upper case and it's all live so I can go down into the menu and it's in the menu already. It doesn't do much and I can go ahead and fill in the script so over here on the right we have a text field. Right now it's showing there's a shebang at the top of that, that says it'll run with /bin/sh, the Born Shell. So you can use other scripting languages if you want, Python, Perl, whatever.
But I'm going to go ahead and use Born Shell, I was a UNIX programmer in a previous life. And to convert something to upper case being an old UNIX programmer I in ASCII still and I'm going to use the translate command just to convert lower case A to upper case.
Lower case A through Z to upper case A through Z. And if I type it correctly, I did say something about not being a good typist, right? Alright, so now we have a translate command.
( inaudible )
( laughs )
Okay, so what's this going to do? Well, it's going to take the input and translate the lower case to upper case. Where's it going to get that input? Well, it's going to get the input from the current selection up, here at the top. You can also have it get things from the entire document or the cases where you don't even need input. And right now it's set to send the output after the current selection which isn't what I want to do I want it to actually replace the selection. So I'll go ahead and change that and let's give it a try.
- So that's actually pretty ugly. I'm just going to undo. Now of course the scripts I mean it's a real command that acts on the text editors so everything works as you would normally expect. You can undo, redo all that sort of stuff. So with that I'll pass it back to Chris and we'll move on with more workflow.
- Thank you Dave.
( applause )
So let's move on to building and debugging. Once you've used the features of the editor to write your code now you need to build it and once you need to run it and once you run it you need to find the bugs in it. Which will send you back to the editor to fix it again.
In building and debugging you've already seen in the demo on Monday the errors and warnings in line, the message bubbles that bring the errors and warnings right in your code. And you saw a little bit of the seamless debugging where you can switch from run to debug in mid-stride. I think you really have to experience this to understand how cool it is. You really forget very quickly that there is a build and debug mode.
You just do what you did last time and if you need to switch, you just switch. You enable or disable break points. There isn't a palpable difference between running your application like you've double clicked it from the finder and debugging your application so that you can step through it and see variable values.
It really is very seamless. And also you've seen the variables and data tips where you can introspect what's going on inside your source code right inside your editor window rather than having to set up a, preconfigure a globals list or put an expressions window in or anything like that.
And finally the mini debugger which is a great tool for debugging full screen applications or debugging situations where layer switching between your application and interacting with the debugger are going to disrupt the flow of the application being debugged. The mini debugger is a great tool that just puts a floating window over your running application with the full debug information including the step controls and including the data tips right there in your running application. And better shown than done, let's bring up Scott Tooker of the Xcode team to show you the building and debugging with message bubbles, the debug strip and data tips.
Thanks Chris.
( applause )
So one primary thing about debugging is when you think about it, it's all about understanding your code better. So what I'm going to go through right now is showing you how you can use our new data tips and step control features to better understand your code.
So as Dave said we are using the project here, Grand Perspective. It gives you a top down view of a given folder and then graphically represents it in terms of squares, each file being a small square as part of larger squares. So let me go ahead and run this. And it's going to ask me for a folder to scan and I'll scan the Grand Perspective sources.
And so you'll notice that I've automatically jumped in which, and so we're actually looking at the build tree for path part here and so this is actually the guts of the program. It actually figures out, it goes and scans everything and I want to learn a little bit more about how it works. So let's go ahead here and just start looking at things in the code. So, for example, I can go here to path and automatically I can just start looking at what is the path that is being passed down. Well, it's to the Grand Perspective folder.
Okay. Well this is kind of interesting but I want to jump down a little bit so I'm going to use some of the step controls and in this case what I'm going to do is just continue to there and so what this does just to be clear is when I click on that line, the little green button, I'm telling Xcode, GDB specifically, to go down, execute to that line and then stop there. So it's like having a temporary break point that then we just remove but it gets rid of the need for you to put in a lot of break points that you just end up wanting to get rid of later or that you trip over later.
Okay, so this is great so it looks like most of the work is done here in build tree for directory, but you know I forgot to set a break point for build tree for directory. And I mean, how can I go, oh well I've got this little button here. And so if I go over here, I can actually inline in the code not even have to go to the debugger bar, I can just click and it steps me right in.
And we actually support this we also support, for example, if I'm on a given line, I can go ahead and just say step next right on that line. And so you can stay literally in your code you don't have to go to anywhere else. I don't have to go up to the debugger bar if I don't want. The controls are right there literally at your mouse pointer. So let's go ahead and drop down a little bit further in this code, because there's some interesting stuff down here with some structures that I want to look at.
So let's use this, continue to step, and you'll notice I've come down here and now I can scroll back up and for example I can go and take a look at this bulk catalog info that just got populated. And you'll notice that, okay, I automatically see the structure, but we automatically, we also notice that oh this is part of a structure so I'll just show you that part. And then I can go and, for example, look and see oh ok so these are the file names and I can jump up and say, oh, these are the FS reps relating to those file names.
But there's even more. One of the things that takes some time and it breaks your workflow is let's say I wanted to go look at dirItem name. And I wanted to understand okay what did that actually evaluate to? Well I'd have to open up the GDB panel or I'd have to go to the textual menu, tell it to print an object, or to call a method and then I'd have to go somewhere other than my source code. But what I can do now in 3.0 is I can actually select this expression, click the information button and there it is right there.
This is the actual live value at the location of the PC for that expression. So it makes it a lot easier for me especially when I have a lot of nested function, if I have methods nested in other methods and I just want to understand, okay, what did this one subpart return. I can select it, evaluate it and move on.
If it also works for example I can come down here and look at this if statement and say well am I going to step over this or not. Well, looking at the code I think I might know but what I can do is go, evaluate and say, okay, it's 0 I'm not going to.
And so let's go ahead, we'll step over and there we go, we didn't step over. So as you can see it's really powerful, it keeps me in my code I'm always looking at my code, and it's a nice augmentation. It's something that's nice for most of your debugging where you're concerned about flow control. We still provide easy access from the debugger bar, things like the debugger window and the GDB console but we think that people are going to find the debug tips really useful.
And then one final thing I wanted to show you real quickly is the new break point message bubble. We've seen it in slides a lot but no one has actually shown it on stage. So one thing I might want to do in this section down here, you'll notice that I'm looping through.
Well, let's say that for some reason I want to actually drop here when I equals two. So what I can do is just go ahead and normally I just set a break point but in this case I want to do a little bit more. I want to set a condition.
So I'm going to bring up the contextual menu on this break point and show the message bubble. And so now right in here I can control whether it's enabled or not, whether I want to automatically just skip over this for now or I can just type in simple conditions, for example, I equals two.
And so now if I go up here to continue, you'll notice I've stopped here and if I just scroll up a little bit and lets look at I, you'll see that I is two. So automatically I've been able to skip over, go straight to where I want with very minimal moving around of windows or losing my context or anything.
So as I think you can see the new features for the data tips and control strip will give you a lot more power to just look around in your code and learn a lot more about it quickly. And with that, I'd like to hand it back to Chris.
Thanks Scott.
( applause )
The simple power of our data tips are really going to help address a lot of the things you've asked for over the years such as being able to see the return value of a function before you return form it. Being able to see the contents of an NS array or a C array or even a STL vector right there in the debugger without having to go down and drill down every element. I think you're really going to enjoy these things. ( applause ) >> Now when you're debugging and when you're writing your code you may need to find out more about your code in order to write it successfully.
And there are two things you need to know. You need to know information about how your code works and where things are in your code and you need to know information about Mac OS X and the set of APIs you're using and we've really added a lot of new things in Xcode 3.0 to help you find that information fast. And the first thing is a fairly substantial revamp of the underlying machinery and Project Find.
Now Project Find hadn't had a lot of love over the last five years, but we really worked on the underlying mechanics of it to make it much faster, much more accurate, much more correct and much more useful to you. The overall user interface is pretty much the same. The one secret is click that options button all of the button is under that options button if you're not using that you're not using Project Find.
But we've added some important new things to Project Find in Xcode 3.0. First, we will find in this project and all reference projects if you have a master project that builds everything else, one project find will find across all of them. Second, we index symbols using the Xcode parser and we do that with Spotlight now. So even if you do a Spotlight search from the Spotlight icon in the menu bar if you search for a program symbol, you're going to find hits in source code where that's used.
If you do a find symbol in project, you're going to find use points of that symbol. So you don't have to do a full text search, you don't have to grep just in case you have a class name that's very similar to instance variable names. You can search for a symbol and Xcode will show you all of the uses of that symbol's the declarations the definitions and the accesses of it in your project with find symbol. We will also search nib files.
If you have connections in nib files to classes or to methods in your code from nib files we index those nib files so that when you do a project search you'll not only find the places in code where those methods and classes are mentioned but you'll also find the nib files in which they're mentioned. Makes it very easy to do a wholesale change on a class even if your nib files are not organized in your project well so that you have to go and search for where that nib file is.
And finally, we've really improved the speed of it. We've had a recent regression in the seed you have so if you do clock measures you're only going to find you know fifty percent faster to doubled, but in previous versions of the Leopard seed we've been up to ten times faster than Tiger and X code 2.5 and we expect to get that back there before we switch, before we ship Xcode 3.0. We're really shooting for equal to or faster than grep speed for full Project Find.
An important thing that we've added when you start up Xcode 3.0 is a new page called Xcode News. This comes up when you don't open a project or a document in Xcode. So if you're going right to your work it stays out of your way. But if you're just launching Xcode from the dock or double clicking in the finder you'll see this panel and it's a miniature web view with some old Tiger style tabs in it that we're going to have to update now for the new Leopard look that give you basic information about being a Macintosh developer using Xcode 3.0. It's got five tabs on it.
First is getting started. We get a lot of frequently asked questions and we get a lot of how do I set up Xcode questions from people who just launch Xcode and they're faced with a blank screen. Well, this is the not blank screen that helps people orient themselves and go straight to the documentation and the tech notes.
The second tab is really cool it's a series of RSS feeds from ADR that shows you the latest tech notes, the latest technical documentation, the latest sample code and the latest news. And you can just subscribe to these RSS feeds straight in this window and every time you open Xcode you will see what's new from ADR and the Apple Developer Connection and by clicking it you go straight to ADC in Safari so you can download new sample code or read new tech notes. The middle tab is a comprehensive overview of documentation with links that take your right to the documentation viewer which I'll talk about in a minute.
The fourth tab is a handy reference to all of the Apple mailing lists with RSS feeds of those mailing lists so you can connect directly to your Xcode users or Carbon dev lists right from Xcode. And finally there's a feedback page so you can give feed back on Xcode, you can file bug reporter bugs and you can file feedback on our technical documentation right from this window in Xcode. This pops up the first time you run Xcode without any window and you can also get it from the Xcode News item in the help menu.
Another thing we've added is the research assistant. We've showed this last year and it's been in the Leopard seed all year. When you open up the research assistant it's a floating window that tracks as you type and as you use or select APIs it shows you a quick summary of those APIs. It shows you the calling conventions, it shows you what class and file it's declared in, it gives you the availability and deprecation information and this is the most important thing.
If you are getting deprecation warnings in your code that say the call you're using is deprecated, bring up research assistant, select that call and the research assistant will tell you what call to use instead and you can click it and go right to the technical documentation for the new call to learn how to do it. So if you're migrating off of old APIs and you need to replace deprecated APIs with new ones the research assistant is a great tool for doing that.
And then finally we've completely revamped the documentation viewer. We've really improved its workflow and its aesthetics and we've rebuilt the model instead of one monolithic folder full of documentation in your developer folder, we've rebuilt it to be a set of modular document sets that can be updated individually via RSS feeds. So you can get incremental updates and documentation one by one as you need them rather than having to download a huge documentation set every two or three months.
( applause )
And once you have those documentation sets installed you can focus your searches on those documentation sets. So that when you're working in Carbon you can only look at Carbon APIs when you're doing kernel development, you can only look at kernel development topics and it really helps you get to your information faster.
We've also changed the searching interface so it's more Spotlight-like so you can use the tab buttons on the top to really focus in on what you're searching. The document, and I already talked about all those. And I'll bring up Brett Shank from the Developer Technical Publications group to give you a demo of those features. Thank you.
( applause )
Thanks Chris. Well, as you know we have three ways to access documentation in Xcode, we have the News window, the research assistant and the documentation viewer. You've seen the Xcode News one on other sessions, so I'm just going to focus on the research assistant and the news window.
So to show you the research assistant, I'm going to use the Grand Perspective project here and open the code window. And you can get to the research assistant from the help menu, you can also add it as an item to your toolbar. So the research assistant will come up here, there it is, like Chris said it's just a floating palette, and when I place the cursor in my source code you'll see the research assistant will update to show me high-level information about this particular API.
So as you can see I see the documentation class reference I can find more information about this symbol in, I see header file, it's declared in as declaration and I can disclose these slices here to get as much information as I want. And again, as you click around in your code your research assistant updates dynamically. So that's great. Well, what if you want more detailed information about a particular symbol? Well, all you need to do is click any of these blue links in the research assistant and that's going to open the full documentation window.
Ignore what I'm doing right now. There it is. So like Chris said we've given the doc window a major refresh in Leopard. We've refreshed both the user interface and the infrastructure we used to provide documentation to Xcode. And we've created a technology called documentation sets. I'll talk more in detail about that in a few minutes, but the important thing to know about them is that they let you include only the documentation you care about and they let you exclude the documentation you don't care about. So if you're not a Java or WebObjects developer, you no longer have to install the Java in WebObjects documentation.
If you want to install those the system makes it really easy to install those doc sets and to get updates from your doc sets and I'll show you that in a few minutes. So for now I want to focus on the new user interface for the doc window, we have, we've introduced the browse mode which is a lot like the browse mode in iTunes all you need to do is click the eyeball here and you can browse all the categories and the subcategories and actually see documents right in line here.
And to pop out of browse mode you can actually click the button or you can just type in the search field and it will take you out of search mode here. And I'll just select NS data. I wanted to point out one thing that you've heard about in other sessions, we also support the class navigator control in the doc window so you see the C over here, this little menu, I can now navigate to subclasses and super classes of documentation, the documentation window itself so I wanted to point that out because it hasn't been mentioned yet. So, let's focus again on some of the new searching features. Like in Xcode 2.0 we have an API search and a full text search, we also have a title search that I'll talk about more in a few minutes. I'm going to do an API search for bytes.
And you can see in Xcode 3.0 we've made it a lot easier to tell exactly what you're searching for and how you're searching. So in this case I'm doing a prefix search to start with search that we have two other search matching types in Xcode 3.0 so if you want to do a contained search you can do that and suddenly I give a lot more results that I got before.
We know you've requested that for many years so we're really happy to provide that to you. You can also do an exact match type and you can see on the list of results here I'm getting result in all different languages, but what if I just care about results in C++? Well, I can configure a language filter, you do that through the tool bar here and now I've created my language filter.
( applause )
So likewise say I want to add C symbols back into that again I can just change the filter and it's really easy to toggle back between showing all languages and filtering on just the languages you care about for a particular task at hand. So we also have another filter for documentation sets so in this case I have two documentation sets installed, you didn't see the third one, the core reference library and the developer tools library and as I select either of these in the doc sets window. One second.
There we go. You can see the list of results updates to show me result just in that particular documentation set. So if you do want to have the Java in WebObjects documentation installed this is an easy way to exclude those or include those in your search results. Okay, so more about documentation sets.
You see this subscribe button right here? Well, I have the doc sets for one vendor installed and that's Apple and Apple actually provides a lot of documentation, more than just the core reference and the developer tools. And if I want to know what more documentation I can get from Apple all I need to do is click the subscribe button and I think we're still having network problems so I'm going to move to the demo machine over here and if the demo gods are with me, alright, so imagine that I had just pressed the subscribe button on this system and now you can see I have all these documentation sets that are available from Apple.
I also see that there's an update to the core reference library doc set right here. So to install that, all I need to do is click update and assuming I was, the network was all working Xcode would take care of downloading that documentation set and installing it. So these are all one click updates you don't have to go through intrusive dialogs, you don't have to go through installer. Xcode takes care of downloading and installing the doc sets for you.
( applause ) >> But there's one more thing. We didn't just create documentation sets for Apple. We created them for you, too. So it's an open architecture we encourage third parties to create doc sets and to deploy them to your framework clients and anyone else and to help you get going with that we've actually written a document.
( applause )
Thank you.
Now I'm going to show you we have this new title search, search mode in Xcode and this is a great way to find all the books that we have documentation, all of our documentation. So I'm just going to type in documentation set and you can see we have a documentation set guide. It's very comprehensive it teaches you everything you need to know about creating and deploying doc sets, we really encourage you to do this it's a great new technology.
So with the research assistant we bring the API documentation to your source code window and with the doc window, we provided a great new user interface and a great new way to install and deploy new documentation. Thanks Chris.
( Applause )
So your project's working or at least it's running. Let's talk a little bit about the life cycle features in Xcode 3.0 and managing your projects.
If your project is working you probably want to commit the changes back to the repository that it came from. And in Xcode 2.0 you can commit individual changes back if you've already set up your project for an SEM system like Perforce or Subversion or CVS. But if you want to create a new repository somewhere, or if you want to get a new project out of a repository you have to go to the command line or third-party tool. In Xcode, we keep those tools out of your way we let you do it within Xcode with repository management.
In the repository preference panel, in the Xcode preferences, you can set up CVS subversion and Perforce repositories and just by typing information into the fields it automatically validates the connections and makes the connection to your repository and it takes care of secure connections as well. So if you happen to be using SSH to connect to CVS or Perforce, it does those connections right in the window.
Once you've connected to a repository, you can bring up our new repository browser and you can interactively walk through your repository and find branches and projects and tags within that repository interactively and then with one tool bar click, bring that project down into your, down onto your disk.
And when you check out that project on your disk that project is already automatically configured for the SEM repository you brought it out of. So it's configured the repository, browse it, download the project, open it and it's ready to go. You don't have to leave Xcode to connect to or browse a repository, you can check out in open projects in a single step and you can create new repositories right from inside Xcode using your favorite SEM system.
But say you're not sharing your work with others or you're doing a lot of experimentation that you really don't want others to see but you want the security of being able to roll back to other versions. Sometimes it's impolite to check in your incremental changes on a main branch or even in a repository that other people are using, because it creates check in messages and you just want to keep this on your local disk but you want to be able to go back to the version that was working. We've built snapshots into Xcode 3.0 to make it easy to do that. You can make fast snapshots of your work using the same mechanisms that Time Machine uses using directory hard links and using an HFS+ disc image that's mounted inside your, on your hard disk.
We make snapshots of your project that are durable and long lasting so that you can roll back to previous versions and go back and get your project file, get individual source files, see what changes are made even compared two different versions to see what's different there and go down and look even to the line by line changes within those files to see what was different between now and then or what was different between the one that worked and one that didn't work, and then roll back either the entire project or even a single file. We think this is really going to help you especially when you're using features like refactoring that make broad based changes to your project. And to show you SCM and snapshots, here's Scott Tooker again.
( Applause )
Thanks Chris.
So let's see. I'll just clean up a little bit here. So I want to just reiterate one thing that Chris talked about which was that source control management is a great tool for all developers. Snapshots is not a replacement for source control. Snapshots is meant to be used on the very lightweight end where you might be working on your own and you don't have access to source control or you don't have something set up.
It's also, though, meant to augment people who are using source control. For example when you're doing things that are truly experimental and you either don't want to bother others with the traffic that would entail or you just don't want to mess up even your own repositories with some things that you just want to investigate on the side.
So what I've brought up here is the snapshots window and this is the Grand Perspective project again and when I was going through and working on Grand Perspective I was taking snapshots along the way. So for example the first one here I have is the initial version 99 of Grand Perspective and you can see when I select one item here I get to see the differences versus what my current sources on disk look like.
And I can go to any one of these and I can just select one. So, for example, I can look at you know, some string names because at some point I went through and I changed some of the localized names to try some things out. We also show you things like, for example, I changed the Info.plist code.
Will also for those of you that are a little more familiar more advanced users familiar with our project file format, we even have the project file format in here. And this is a code word style view, not a code, sorry, not a code word, file merge style view.
( Laughter )
Yeah, yeah, yeah.
Telling my background. And so anyway, you can just go ahead you can use the space bar, which provides an experience very similar to Mail. Or so, for example, I can space through to get to them. Or I can just use the arrow keys to move up and down. And you'll notice for each one we selected you can see the differences.
Now, it may also be that you want to look at, well, I don't really care so much about what we have right now but what did I change like two days ago verses three days ago? So I was looking at something there and I think I've introduced the problem.
So, I can go ahead, and, for example, just look at the first and the second here. And then I see, well, okay, when I cleaned up the project obviously, you know, pretty obviously it was mostly dealing with the project file. And so I can just focus in on those changes right then and there.
Now, one other feature we added due to feedback was that a lot of people want to be able to go back and say something like. Well, you know what? I want to go back to where I cleaned up this project there. And I want everything else, like, for example, in this Info.plist, I changed the string, I changed the version. I want to keep that. But it turns out the names, as cool as I thought they were, other people didn't like them. So, I want to roll back these localized names. So what you can do is, you can just select this one file and say restore.
And when I do that all it does is it goes back to that snapshot and pulls that single file forward into my current working copy. All the other files, all the other changes, they're still there. But now I've been able to extract this one file out and get back to my work with minimal fuss.
So, as you can see snapshots really provide you a lot of flexibility in both understanding where you're going, where you've been on these kinds of small scale experimental jaunts. But, it also provides you really nice ability to correct course as it were, take individual files back. And now, a quick word about SEM. So, I finish up here and I want to go and check this into SEM. And so, let's go ahead bring up the repositories window.
And you'll notice here I have a couple repositories just sitting around. These are actually stored at the app level so, what you do is you only have to define your repositories once and you can use them across multiple projects which makes it really nice when you may have, like with Xcode, tons of projects that you need to deal with. So, what I'm going to go ahead, I've got this WWWC demo subversion repository, there's not much in it right now. Let's just create a directory and we can call it, you know my project or Grand Perspective.
And I can put some, I can put comments in here, new directory, and create directory. And there it is. It's automatically in there. You'll see on the bottom here we're actually showing you what's going on as far as the steps being taken with your source control environment. And then I can just go ahead select that, and say import, and I can just choose the Grand, in this case, just to make it a little bit clearer, I'm just going to choose this Grand Perspective directory right here. I can say my copy.
And so there it goes. And I can, and you'll notice here it's just completed. It's actually been imported. And now if I wanted to I could go easily and just check that back out. And you'll notice we actually give you quite a bit of detail here on exactly what went on. So that you know exactly what we did when we imported or what we did when we exported.
I should also point out that this works with all the systems that we currently support Perforce, CVS, and Subversion. So, I hope you can see that not only are we providing you some interesting ways to experiment with your code like snapshots, we're also providing improvements to the tools you use every day like source control. Thanks Chris.
[Chris Espinosa]
Thanks Scott
( Applause )
Now in addition to the big changes in the editor, the big changes to debugging, the big changes to documentation viewing, the big changes to repository and source code management. We've made some other little workflow improvements that you've requested over the years.
The open quickly menu will now search that same symbol data base that we do with find. So, if you have a class that's not in a file of its own name you can just open quickly, command shift D type the class name and you'll go right to the file that declares that class. You can do that with any symbol that's in the index. Open...
( Applause )
So if you want to go to a specific line or if you're looking in your full build transcription it says that the error is at, you know, this line of the make file with the file name colon line number. You can select that, command shift D. You'll go directly to that line.
( Applause )
( Applause )
And this will remember what context, project context the files were in. So if you've got a project open and you open a recent file it will open it in the context of that project. So you've got all of the in project navigation. And then we've added a little tool called, that we call xed, the Xcode editor command line tool.
This is in user being in your developer folder and so you should put that in your path if you want to execute as a command. You can use this as the editor environment variable for things like command line check ins. Or you can pipe text to it and it will open it up in the Xcode text editor.
So if you want to use code folding and code focus, if you want to use the scripts in our script menu, if you want to use the features of the editor, on a file that you get from UNIX command or a piped text or open up a file on the disk you can use the xed command to do that. And interesting enough, if you've been going to the scripting bridge sessions, xed is completely implemented using the scripting bridge back to Xcode. It's a really interesting application technology.
And some other things that you should really be interested in but are covered in their own sessions the Xcode Organizer. Go to the Project Tree Xcode session and you will learn all about how to use the Organizer, not just if you're an Xcode user and want to use it with Xcode projects to organize your Xcode projects, but also if you're using open source projects and using Makefiles or non-C, non compiled languages: Ruby, Python, things like that.
Or, if you just want to, if you want to navigate, search and make snapshots of random sets of files on your disk and execute scripts on them. You can take any directory from your disk whether it has code in it or not, drop ot in the Xcode Organizer and you can make snapshots of it, have generational storage of the changes in it. You can use the inline editor to, the in window editor to edit the files in it.
You can use the script menu to execute scripts, on it. And I even use this as you can see, to keep backups of my presentations as I was developing it. I just had a presentations folder that had my Keynote presentations in it. Every once and a while I would make a snapshot, and if I made a change that was wrong I can go back and restore it from the snapshot very quickly without having to, you know, go back and navigate in Time Machine or go back and save several copies of my keynote presentation.
It's a really general purpose organizing tool for editing and manipulating and performing script actions on information. We think you're really going to love it. Also the refactoring tool, there are several sessions on refactoring. You should really go look at it. If you're using Objective-C and need to make broad based changes in a project and maintain a semantic meaning of the project then refactoring is for you.
So, let's wrap up. In Xcode 3.0, we put in some significant improvements in your workflow that help you focus on your work. You can choose and use the version of the tools you need. So you don't have to use the wrong set of tools in order to do your work just because of your choice of operating system. With Xcode 3.0 and Xcode 2.5 you can choose the version you want. And you can use the version of the project file you want.
You can focus on the task at hand in the editor with code focus and code folding to keep extraneous code out of the way. You can keep your code front and center at all times. You can do a lot of navigation including class navigation right there in the browser.
We don't have a debug mode anymore. You can go smoothly between running and debugging and running and debugging without having to quit your application, turn on the debugger, and go back and work your way back through the application to where you happened to have been. And if you're using our performance tools it remembers which performance tool you're using so that when you build and go, if you had launched under Xray or Shark the previous time it will launch it under Xray or Shark the next time.
We can find code and documentation faster with improvements in Project Find, a better documentation window, and the research assistant to show you a quick summary of the APIs that you're using in your code. And finally, you can share work with others and keep your work safe with the integrated repository management and the built in snapshots for Xcode projects and for the Organizer to keep generations of your work as you go and roll back individually as you need.
For more information Matt Formica is going to be up here. We'll do some Q and A, the documentation sample and other resources we'll just fire up Xcode and go to the help menu. And all the information is there including the Xcode 3.0 release notes, which is a really good comprehensive list of what's going on in Xcode 3.0.