WWDC2004 Session 308

Transcript

Kind: captions
Language: en
good afternoon so today you have two
sessions on increasing your productivity
with Xcode and many speakers on stage
today are going to be telling you how
you can increase your workflow in the
Edit build debug cycle with the
workspaces documentation scripting etc
each of them are going to refer time
again to a certain core set of elements
within Xcode so I thought it would be a
good idea to review those elements now
tell you what they're all about with
their purpose is and you know talk about
a few tips and tricks that you can use
to make better use of them now of course
Xcode wouldn't be a very good developer
tool that didn't have an editor and
Xcode has a great editor it's faster now
than it's ever been before and he can
take better advantage of it by turning
on various visual elements for example I
like to turn on the gutter and the split
control you can turn on the gutter via
the View menu and turn on the split
control via general preferences and
split control will allow you to split
the editor any number of times and close
different splits etc if you like to view
different parts of your file at the same
time and the gutter will show very
various line level attributes of course
the line numbers that that is for as
well as ears and warnings breakpoints
all that kind of good stuff now the
separate editor window in Xcode in the
upper right hand corner by default has a
tool item called the editing mode now I
know a lot of you out there like to use
a separate editor window for every
single file you open up that's a code
war style and I can appreciate that too
i like that mode a lot also but
sometimes that becomes too much and you
you hit periods where you want all the
flowers to just be in fewer windows and
so you can toggle the editing mode
button on and when you do that all files
that you double-click on are going to
open in that same editor window and
you'll use the navbar in the editor to
navigate between them and of course you
can just toggle that off again
everything goes back to the way it was
where everything opens up in a separate
editor window
Xcode separate editor window like all of
X Squared's windows has a status bar and
the status bar and the seeds that you
have for 15 and 20 today focus mainly on
build information and you'll find out a
little bit later where other types of
status information go a really good
solution for that as well now when you
build you're going to see a lot of
different places that will tell you
what's happened in your build in the
right hand side of status bars is a
dedicated area with build buttons that
will tell you whether build succeeded
failed or was canceled by you as well as
possibly buttons for any errors or
warnings that have been encountered when
the build was performed now you can
click on those and it will take you to
the build pain and we'll see that in a
minute too now if you have any errors or
warnings in the file that you're editing
you're going to see some other things
that are really handy in the gutter
you're going to see little icons on the
line numbers on the line that's our
refer to Arizona warnings for that
particular line in your source file and
we'll have a badge for error warning if
you click on those the status bar will
show you the actual build message for
that and if you hover over them with
your mouse you'll get a tooltip i use
the hover mode a lot when a build is
ongoing and you're getting a lot of
compilation messages going through and
maybe it hasn't stopped because it's
just hit some warnings but you see that
pop up so you can hover your mouse over
and say oh I see you know this morning
is about that now you'll also see in the
latest release of Xcode little hash
marks in your vertical scrollbar and
we've actually had radars reported
there's a drawing glitch on the scroll
bar but what that actually is is it's
indicating lines that have errors or
warnings this is like the file merge app
that we have on our system so that you
can just scroll the thumb down to those
hash marks when you get immediately to
your ears and warning and if you're
porting any code or anything you have a
header a macro defined incorrectly in a
header you'll know that right away
because all the sudden you'll just see
red throughout your scroll line you have
something is really in luck there now
another very important element of Xcode
if the groups of files view
now all developer tools seem to have a
view like this it's a hierarchical view
with your files and your folders and
your groups and Xcode how's that as well
but last year we took a step further and
you've heard a lot about smart groups
this week and last year we built smart
groups into X codes groups of files view
smart groups for xcode are auto
generated content based on particular
topics so for example we have an air
zone wanting smart group and this smart
group is populated with all the files to
Xcode is aware of that have errors or
warnings against them we also have a
couple of other important smart groups
for example we have a target smart group
that contains all your targets and 14
executables that contains all your
executables it also be important for you
to find your which targets you want to
inspect and change settings on etc now
new in the seed is the ability to decide
which smart groups you want to show and
you'll see later on that in the newest
seeds the roots of files view is that is
present in many different windows and
will have different subsets of all the
smart groups available so if you bring
up the context menu on the project
structure the groups of files to you
you'll be able to select which smart
groups you want to show and the in that
group so Fabio and of course I should
mention that there's another type of
smart group which is a custom one that
you can create it's just based on
regular expressions right now filtering
on the file name of the files in your
project but it's very handy if you want
to have a folder that contains all your
resources on your nibs all your images
your source files your header files it's
easy through you create those and again
the groups of files to you supports type
select so you can navigate through the
groups of files now another view that we
introduced with Xcode last year is a
detailed view it works hand-in-hand with
a groups of files view and as its name
suggests it provides more detail about
the files you have selected in groups of
file to you now each smart group has a
different type of detail view one of the
really important detail views I get this
question a lot is it has to be with
setting your your Heather's to be public
it you do that by clicking on a target
and you're in your groups of file to you
the target detail view will appear and
you'll see a column that's called rolls
and if you select a header file in that
and it's select that rules pop up it
will allow you to choose whether you
want the header to be exported as public
or private the detail view also supports
filtering so there's a search field in
the window toolbar and you can filter on
the detail view you can bring up the
context menu on the header of the detail
view and display different columns of
course you can sort the columns and new
in the seeds the detail view supports
all the file operations of the groups of
files view does it also supports type
select so you can sort a column then you
can filter down and then you can type
select to the end when you get to where
you want to be you can hit the return
key and that would for example in the in
the default layout it would load the
file in the embedded editor or option
return will load it in a separate window
it's just how the group so files view
works as well now eventually in it
software development tool like Xcode you
hope to build so we have the build
results pane now normally if you're like
me after you're familiar with all the
steps that your product uses to build
you probably don't need to see them all
laid out as you're building all you need
to do is know that an era warnings
happened or you know the bill failed for
some of the reason and the elements I
spoke of earlier will give you enough
information to to find that out but if
you do want to know the build steps that
were taken and the the order in which
they happen the order in which there's
and warnings were admitted go to the
build results pane and it has controls
to filter that information to collapse a
way to build steps or hide or show the
warnings and finally if if you're
wondering well you know I set this build
flag and it doesn't I'm not getting
results that reflect that flag let me
check the raw build log and the build
pain which is the middle pane you have
your your your outline view on the top
we're all build log and an attached
editor let me check the raw bill blog to
see the exact flags that were passed to
the compiler to compile it in the file
that's really handy and of course as I
mentioned in the latest feeds wherever
you find a build pain you will find an
attached editor so that you can go
through your ears and warnings in line
and fix them now if you need to search
across a project or across frameworks
across a subset of files you can use the
batch find mechanism in xcode and
they're powerful options that you can
use to adjust your query and adjust your
search and replace and you can bring
that up and you can do things like
specify fine sets let's say you work on
a large project but where you're a
responsible for is really a smaller set
or maybe sometimes you want to find tags
that are only in XML files and other
times and other types of files you can
create different fine sets and use those
at your discretion when you're searching
now possibly one of the most important
views in xcode is the inspector and
that's becoming more and more important
you go to the inspector to view or edit
any fine grained project level settings
for example if I wanted to change code
sent settings I would inspect the
project which is at a very top note and
groups and files view if I wanted to add
an argument to the executable when it's
launched I would expect an executable
now new when the seeds is the ability to
do multiple selection and this is a
great time saver because let's say you
wanted ten different files to be
compiled with a particular bill flag you
just select those 10 files and the
groups of files to you or the detail
view and you bring up an inspector and
you go to the build setting and you
apply it there and it's applied for them
all across the board that's just really
great big time saver in addition an
inspector has a search field at the
bottom if you have all of the options
showing an inspector for build settings
for something it can be quite a few so
you can whittle that down you don't
really even need to know all the
settings you can take some guesses and
explore the options and just type so
type in the search field and it will
narrow down if you know what your look
for you can actually now click in the
table of the inspector and again use
type select just like you can in the
detail view and the groups of files view
and it will bring you down right to that
option now you initiate many activities
in Xcode you ask it to build you ask it
to bug run an executable do a batch find
etc when you do that you're going to see
something called the tasks button get
enabled and in the lower right-hand
corner it's going to be badged with a
type of task it's doing it might have a
build hammer if you're building in a
little spyglass you're doing a batch
file etc and if you're if you just want
to stop the last task that you initiated
for that project you can just click that
button like it was a regular toolbar
item and the task will stop if you're
running more than one task and you want
to pick and choose which one you want to
stop then click and hold on the task
button the task list will pop down and
you can choose which taps you want to
stop now as I said earlier we have a
step ahead now in Xcode gaspar status
goes and that's because we have an
activity viewer now that spans all
projects that you have open it shows all
tasks that are running that includes
also tasks that Xcode is performing on
your behalf but that perhaps you didn't
directly initiate yourself for example
the project maybe we indexing or it may
be performing an svm operation you'll
see all of those in line you'll see
their progress and you'll also see
different status messages if it's a
building you'll see which file its
building which target is building it's
doing a batch fine you'll see how many
batch find you know five hits it's
actually received so far etc and you can
stop task directly from this activity
viewer and when you close a project
you'll just see that project disappear
from the activity or you reopen it
reappears again that's project wide if
you want to see all your tasks for all
projects now Xcode has a lot of
preferences and I want dare try to go
into all of them here i'm sure i don't
even know a quarter of them myself but
there's a there's a small step it's
that's very powerful as far as your
workflows
so let's let's look at these now one of
them is ability to save and restore your
window states you're working a project
you know family your home for dinner and
you close it you go home and after
dinner you know you reopen your project
and you want all the windows to be right
where you left them and everything in
the right order etc if you select these
general statement or store state
settings for your workspace that's going
to happen for you and new in the seats
that you have for one at five and TL is
the ability to save and restore separate
editor window state as well so that's a
big time saver now another thing that
you can do if you use the embedded
editor a lot I use that a lot you can
select the auto open option and if you
do that then if there's an embedded
editor in the window that you're
selecting something else in it's going
to automatically pop open for you you
don't have to drag it open or double
click it open yourself so I like to set
that setting in addition we saw in the
talk about the editor the split controls
that you can turn on now you can turn
these on globally for all open projects
for your groups of files view as well as
your supper editor window and new in the
seeds is the ability to split these
these items more than one time into
clothes whichever one you want to close
and finally we've added a couple more
work spaces to Xcode and there's a
control to select that workspace and
we'll go over that in just a few minutes
now also new in the feeds book you have
it went up five and two that o is the
ability to set defaults now out of the
box we have certain sets of window
positioning and sizing for all different
windows in xcode but we're all different
here and we all like it a different way
so you can position your windows the way
you want them and then go up to the
window menu pick the defaults menu item
in say to xcode all of my windows i want
you to use this for any other projects i
open new in addition once you've done
that once you'll see another button on
that dialog it says restore to user
defaults that's the setting you just set
you can go back to previously open
projects and restore to that setting
let's see you move things around here
like okay I want to get back to my best
setting you can do that you can also
restore to factory settings also for
your separate editor windows you can
choose what size status bar visibility
etc for the separate editor windows by
doing the same thing you have a separate
editor window open and you just go up to
window default and make that your
default for the separate editor windows
now as I mentioned we have two new work
spaces in xcode ql we still have the the
default workspace that we came up with
introduced in 1 dot 0 plus many workflow
refinements and a few pixel refinements
but pretty much the same thing in 15 but
instead o we have two additional ones
now we all work differently and we also
work in different situations we may
prefer to work one way but because we
find ourselves having to deal with ten
projects at some point or a very small
screen or we're lucky enough to have a
30 inch screen you may want to use extra
differently you now have these three
workspaces in xcode sudado to choose
from in addition all of these have
exactly the same functionality if you
learn for example the keystrokes in one
you could close your eyes so which
workspaces close your eyes and do the
same keystrokes the same exact thing
would happen it would just happen
appropriately for whichever work space
you have so as I said Xcode 1 not 2 plus
plus is the default workspace and this
was always focused on providing a
separate window for each task you were
performing we were building you were
looking at the run log you were editing
you were debugging you were editing the
project the targets execuse etc and in
its project window it had a groups of
file to you in the last detail view on
the right and the embedded editor now
one of the new workspace is the
all-in-one workspace and this is
designed to reduce window clutter again
if you're in that situation where you
have 10 projects open if you were using
the default workspace you would have
quite a few windows open that would be
very difficult to manage you also may
simply prefer to have the all in one
form factor most tools out there have
all in one project builder had all in
one so definitely there's an audience
for that and you have an option now now
the all-in-one workspace separates
groups of corv use those core elements
we went over earlier into pages pages
are based on tasks so you have a project
editing page you have a building and
running page and you have a debugging
page there's a page control and upper
left hand corner of the tool bar to
navigate between them but if I'm on say
the project editing page and I want to
see the build pain I do the same thing I
always did shift command B and the build
pain will come forward just like the
build pain will come forward in the in
the default workspace and lastly each
page in all in one workspace has a
custom toolbar and you can refine it
further so the debug page has all the
debug buttons obviously as you'd expect
for example and lastly we have the
condensed workspace and this really
caters to those are coming from Kota
where for example it's basically the
same as default workspace but the
project window is broken into two pieces
you have the main project window with
three tabs your file tab your targets
and executable tabs and a tab with other
smart groups and then you have a detail
window with your detail view and another
groups on coliseum and earlier when I
mentioned that you could hide and show
different smart groups in your groups of
file to you that's really handy in the
condensed workspace because you have
those three tabs so you can arrange
things away like them and now I just
want to take you on a little drive
around the three workspaces show you a
few things and then I'll sum up and I
hand it over to the next speaker
so when you open a project it's going to
look basically like this when you first
get exco 15 or 20 in the lower right I
have the activity one of those speaking
of earlier and if I would do something
like build it would show build status
etc now I have my groups of files here
on the left a detail view on the right
and an embedded editor in in the lower
right hand corner I can view different
files there we have a classic splitter
now and you can double click on those
like you can and mail to collapse them
to the left or downwards and you can
really expand them and we've changed a
bit for those who are already used to
this UI the behavior of the editing
toolbar button because previously it
behaved like our splitters behave now
and we found that most of the people who
are using that they were thinking to
themselves I want to focus on the editor
so now when you click on the editing the
editor toolbar item it will fully expand
the editor or bring it back to its
previous state it's a very subtle
difference but for those who use it i'm
sure you'll find it's a worthy addition
to the UI now let's say for example that
that you did have it fully expanded and
you wanted to use a new feature new
keystroke and workflow behavior that's a
favorite of mine in one at five and one
and 20 you want it to go directly to the
detail view and start searching instead
of dragging the splitter down and
clicking a search field and all those
things now you can by default you just
do command option f it will expose the
detail view however it was hidden put
your curse in the search field and your
you're ready to to go so that is a bit
about the default workspace and now I
want to go and take a look at some of
the others let me close this workspace
to switch workspaces you need to close
any open projects now go to preferences
and I'll select all in one workspace and
then I'll just reopen my project and
this is all in one workspace it looks
very similar
actually at a distance but you'll notice
a couple of different things first of
all there's a page control in the upper
left-hand corner and the detail view
experian replaced the tab has the detail
view projects lined and as well and sem
pain then you have the embedded editor
of course now all of the tab views in in
15 and 20 now for the project window our
drag-and-drop aware so if i wanted to
you know drag an item from from one page
to another i can just drag it over those
pages and it will automatically switch
to you know wherever i'm dragging and
you'll see how that's used even more
benefit in the conviction workspace so
let's take a quick look at that now
let's close our project again go right
to the condensed project workspace
select that open our project back up
here we see it by default opens in the
far right corner it has the three tab
views and I always said it's basically
the same as a default workspace but
let's say for example that I wanted to
add a file in my in my project tree to a
particular build phase of a particular
target I'm in the files tab right now so
I can select a file and I would go in
over the targets tab and I'm doing their
targets and bring it you know go under a
particular target that I had open and
then I'm going to build phase and I
would just drop it into that build phase
so it's very very easy to use and of
course as I said before let's say for
example that under files I also wanted
to have a different smart group showing
I don't know let's say I wanted to have
my bookmark showing so I could show that
smart group as well and again you can do
that anywhere you find the groups and
files view and let me just open up one
more project here
and as you can see this is a freshly
open project so it's indexing and I'm
building and running and so you see this
the status of the two different projects
and you can collapse them etc so with
that let me go back to the slides and if
you could i'd like you to remember three
things actually a fourth thing that I
thought of earlier today and it's on the
slide but the first thing things are
when you get especially Xcode to do on
your tiger CD take a look at the
different workspaces because each one
fits on personality is a little
differently and it can really boost your
productivity if you pick the right one
and next don't forget those workflow
preferences that we talked about there
on a general preferences pane and
they'll really add to your workflow and
third you might want to define your own
window defaults that fit your needs a
little better and then for that fourth
thing that's not on here it's again the
question I get asked the most which is
how do i exploit my headers public or
private remember you click on a target
you hit see the target detail view and
you use the role column and the target
detail view to change your headers to be
public or private so with that I'm going
to turn it over to debuting who's going
to talk about code sense and source code
management okay thanks Steve
well Steve's been talking to you a lot
about getting around xcode I'm going to
talk about how you get around in your
code in Xcode so Xcode has a number of
technologies in it and together we like
to call that code sense so it's
basically symbolic assistance for your
project we parse and index your source
code and then with that information we
can help you move around and give you
assistance in your project so we have a
number of features within Xcode for this
we have a project symbol smart group you
saw smart groups a little bit i'll show
you a little bit more of that in a few
minutes we have a standard class browser
there's a number of navigation
techniques you can use inside of an
editor and finally we'll talk some about
code completion so first the project
symbols smart group as I said it's a
smart group it's sitting in the bottom
of the groups and files tree over there
when you click on that you show all the
all the items that are defined in your
project all the symbols in your project
and like any other smart group you can
filter the details so you can filter by
the name of the symbol the type of the
symbol or the source file in which the
symbols defined and of course we have a
class browser that on the left hand side
is showing a hierarchy of classes and
above the editor pane there's a list of
the methods and fields for the selected
class in the class list you can either
show that hierarchically or just show a
straight flat list of all the classes in
the project and of course you can show
just the project classes or the project
classes in any framework classes that
you've imported in your project and for
classes that are defined like in cocoa
where we have documentation on the
system you have quick access to that
documentation right in the class browser
okay in the text editors Xcode there's a
navigation bar at the top of every
editor pane that gives you access to
functions within that file you can
actually switch back and forth between
files if you're editing multiple files
in the same thing too there's a
counterparts button that takes you
between a source file and a header file
that did match by name of course there's
also a pop-up list of imported files or
included files and there's two other pop
up lists for break point break points in
the current file or bookmarks that are
in the current file and then two of the
best ways to get around in your code our
command double click which would when
you command double click on a word in
your file we'll do a lookup in our index
and take you directly to the definition
of what you clicked on or if there's
multiple definitions it will give you a
pop-up list and allow you to choose
which one you want to go to and finally
there's also option double click which
will do a documentation search for that
symbol so code completion we have all
this information about your project and
when you're editing your code sometimes
it's really it would be really nice if
we just helped you enter the text that
you're trying to type well that's what
code completion does for you its context
sensitive so it knows what method you're
in it knows what's available to you at
that point you can set a number of
preferences for how it works you can
have it setup to automatically suggest
what it thinks you want to type in or
you can have it brought up only on
demand by hitting a command key actually
auction asst cases the default key for
that when it inserts text if it's a
method or function call it can insert
argument placeholders for for the
arguments to that method and when you
bring up a list you can actually have
the list narrowed down to only those
items that match what you've typed so
far
are I find that very convenient myself a
number of implementations of code
completion on other systems actually
always give you this big huge list and
while it takes you to the one that
matches closest there's still a huge
number of things there and it's
sometimes hard to find your way around
so in the seeds that you guys have the
1.5 and 2.0 seeds you'll find the code
completions a bit faster than it was
it's a bit smarter it's a it has a
better idea of where it really is and
gives you a better list of suggestions
and of course we now have some support
for Java with that I'm going to give you
a demo of code sense here let's go ahead
and switch over to my user and again we
have a parent sample the first thing I
want to show you is the project symbol
smart group and that's down at the
bottom so we click on that we can see
that we have quite a few symbols in this
project clicking on them take you
directly to the code and you can search
let's search by the symbol name and just
type about so let's see
so one thing you'll notice where you C++
developers that used Xcode in the past
it's actually showing the constructors
and destructors for the C++ code which
is a nice change for you okay next I'd
like to bring up the class browser here
under the project menu I'm going to go
ahead and knock can click on these to
show the full hierarchy this is also
another nice thing that's changed in
this version of course C++ support we
didn't always get it right here here
you'll see the actual full hierarchy of
the classes in this example so that's a
nice change for you all so we can click
around and it takes you right to the
declarations of the symbols if we click
on methods up here it takes you to those
declarations one thing that's important
to know is if you option click on these
items it takes you to the definition of
those symbols so that's something that's
kind of hidden and people have a hard
time finding it first finally I
mentioned before that you can show the
view you can show all the classes as a
flat list one thing that's very
convenient about this is if you have a
class you know the name of it but you
want to find its parent class you can
click on the class and then switch back
to the hierarchy view and it actually
expands the hierarchy showing you that
class that you can easily find the
superclass there all right so I also
want to show you how to configure some
of the options here there's quite a few
options so bring that panel up so the
options here in this list are just four
different options that option sets that
we provide for you you can add new
option sets and you can actually change
the option sets that are here so one
thing that might confuse you so don't do
this is click on the flat list here and
it still named hierarchy all list now
that'll confuse you because it
do what you expect if you want to show
new a new group of options let's go
ahead and add a new one and we'll just
call it my new option set and let's go
ahead and turn on showing of inherited
meth inherited members and I'm also
going to show method and data so the
methods and fields for this class up
here in the top methods list you'll see
that some of these I'm not sure how well
that shows up but that's shown in gray
there that means that those members are
inherited from a superclass and down at
the bottom of the list you'll see that
field show up and in fact the fields for
super classes also show up there okay
well let's go ahead and look just at a
editor window and show some of the
features in the editor window itself so
at the top of the window here this is
called the navigation bar across the top
of the editor this is available in any
editor wherever you are inside Xcode the
first two buttons on the left here are
the left and right buttons for your
history if you've edited more than one
file in the same view you can click
those buttons to move back and forth the
next button is a pop-up that shows you
all the files that you've edited in that
view here when you're in a separate
editor you'll normally only have one
file there the next thing is what we
call the function pop-up and it lists
all the functions methods actually can
show all sorts of things macro
definitions declarations pragma mark
warnings pragma pound warning those
sorts of things next over here on the
right there's a there's a bookmarks menu
so you can set up bookmark see fine add
to bookmarks and it just goes ahead and
adds it there so you now have a quick
bookmark list you can also have a break
point so if we go and set some
breakpoints in here we now have a pop-up
that shows the breakpoints
this next button is called the
counterparts button now the counterparts
button normally switches you between
your header file in your source file
I'll go ahead and do that and it takes
you right to the header file so that's
pretty nice that's convenient but you
know sometimes you want to focus in on
something in particular so I'm here in
the header file and if I put my cursor
on the declaration for the run modal
method if I option click on this button
it'll go right to that definition for
that and the same same goes the other
direction of course if we option click
will go right back Oh actually that one
we didn't go right back to well yeah we
also have an import popup menu and you
can go to any of the imported files for
a file when you're inside the header
file it not only shows you your current
file and the files it imports it also
shows all the files that import it which
looks like pretty much every file in
this project since that's the prefix
file that makes a lot of sense okay the
last thing i want to show you here is
something that's somewhat hidden if you
look into your key bindings preferences
in xcode you may have run into this but
it turns out that you can get access to
all the all the menus in the file
navigator right from the keyboard and by
default we bind control to to go to the
function popup menu and then you can
just use the keys to move around there
so you don't ever have to use the mouse
to move between methods there can poke
control three I think is yes is bound to
the imports pop up and four and five
rebounds to the bookmarks and
breakpoints pop-ups too okay last but
not least here I want to give you a
quick show of code completion here if we
go ahead and enter in some new text
let's see so here I've typed in quit a
and its underlying what's there the
underlying indicates that it knows that
there's more that there's an ambiguous
completion so there's more than one item
that it can complete to the two letters
a PP show that it knows that everything
that starts with quit a also has quit a
pin it you can hit a option escapes to
complete that at this point you can also
hit it again to bring up the list of all
the possible completions so let's go
ahead and select the lower item there
and hit tab to continue it so we
inserted an argument placeholder here
this shows you that this method takes
one argument which is a window ref type
no surprise since it's on the line above
two now there's a couple of ways you can
go to the arguments the common way is
control / will actually take you to the
next argument placeholder so if there's
an argue if there's a method if you've
inserted a method with multiple
arguments type something in and just hit
control / it'll go to the next argument
and let you type that one to fill that
in another thing you can do you can also
double-click on the angle brackets and
it'll select all that text for you so
let's go ahead and insert the rest of it
get window rough and this has a number
of items here let's keep typing and
insert it so there you go code
completion I want to show you a little
bit about the code completion press
there's a number of options you can
configure for code completion you can
set them in the preferences for all of
your projects or you can set them on a
per project basis by selecting the first
item in the groups and file lists the
top item the project icon and doing get
info on that or you can double click on
that icon actually to bring up the same
panel but here i have it set to
automatically suggest a matching option
for me so that's the part that does the
underline
if you have this next auction set it'll
always bring up a list rather than doing
the underline it'll bring up a list
there this is similar to how it works in
visual studio number of other
applications you may have experienced
code completion in and finally at the
bottom you can either insert just the
simple name of what you've been typing
or four methods it'll actually insert
the placeholders over here on the right
is some configuration of the function
pop up so I actually like to hide most
of the stuff this isn't how my machine
would normally be set up but often when
you're in a header file you end up
having these huge huge list and I just
don't find that quite so useful okay the
last thing I'm going to show you I'm
going to mention here we've sped up
indexing quite a bit i mean in the java
case indexing the system jdk class files
is about ten times faster than it then
it used to be but sometimes that's just
not fast enough and it does seem silly
that we always index the system header
files every time you open a project a
new project that is so there's something
called index templates and I'm going to
just bring up a Finder window here
inside the developer extras Xcode index
templates directory you'll find a readme
file now this readme file basically just
tells you what they are and tells you
how to run the one command that it takes
to set them up so index templates make
it so that there's files sitting on the
on the machine with precooked indexes of
all the system header files so you don't
ever have to index those again if you
rebuild your index those still those are
still there so okay with that I want to
pass it off to oh oh good point hey I'm
getting too anxious I do want to go back
to the slides I have a little bit more
to talk about just having too much fun
source code management ok so we've
talked about moving around in Xcode
we've talked about moving around in your
code in Xcode well there's also a lot of
his
treat to your code hopefully you're
using a source code management system
and we provide full integration of
source code management within Xcode so
all the capabilities that you need on
your daily basis are here we have so we
have columns in the files or the groups
and files list we have a smart group
that that shows you all of the status
for any files that are different from
the repository we have another window a
source code management window that shows
you that same information but if you
want to have it in a separate window you
can put it there and we have inspectors
so when you inspect individual files in
your project you can look at all the
revision history from within that window
it's also easy to do comparisons between
revisions do a quick diff at Apple we
like to put dis in our bug reports when
we fix a bug so that's a convenient way
to do that so we as I said we support
your daily workflow within Xcode you can
add and remove the files from the
repository you can update to the last
version that's in the in the repository
if somebody's made a change and you want
to get that version or you can commit
your revisions we can compare and if
versions and we can also view annotation
so an annotation is a view of the source
file with every line containing the
revision number and the user who made
those changes a lot of times people call
that viewing the blame version of the of
the source code and right now we support
the three most requested SCM system CVS
which is something we use extensively
throughout Apple perforce which was
requested highly from all of you folks
and subversion which is a new
open-source revision control system
that's really gaining a lot of
popularity
okay now I've got one more little demo
for you
hey so the first thing i want to do we
have a project here this is just a
parent sample and the first thing i want
to do is bring up the project info for
this project let's go ahead and switch
over to the general preference pane at
the bottom you'll notice that there's an
enable SCM check box you can turn that
on to enable source code management for
that file for that project and you can
switch between the different versions
make sure you pick the right version of
course and the last thing especially if
you're set up to use subversion
subversion can actually be installed in
a number of places on your system so i
used think to install it and think likes
to put everything inside a flash SW so
my version of subversion is living in SW
bin svn so right now you don't see any
source code management but i want to see
some so i'm going to control click on
the title of that view and you'll see
that we have we've modified the project
since last time it was checked out
that's no surprise i've been doing stuff
up here on the screen we have about
windows you can see the icon there is
grey that means that it's that it's
changed if i go ahead and say that
you'll see that the status updates right
away so the M means that it's modified
relative to the repository so there's
some local change here if you have a
file that's not checked in yet and you
said that you want to add it it'll show
an a there if you've made local changes
and there's changes in the repository
it'll it'll show see for conflict and
it'll show you if you need to update it
I believe so ok so we also have an SEM
smart group let's go ahead down there
and take a quick look at that you can
see that it shows those files in there I
never did check in my PBX user file
sometimes we generally do that at Apple
we'd like to do that I didn't do it here
so the PBX user file for those of you
don't know contains your user specific
settings for a project it sits inside
the project bundle so we can also bring
up the sem window now this looks a lot
like the same view same stuff that's in
the SCM smart group but one thing that
it has here is it actually has all of
the commands that have been run when
you're using sources when you're using
the sem system so you can look there to
see what's actually going on underneath
the hood if you need to okay so I have
this this local version of course on
here I don't really want to have that
I've got this extra code so I'm going to
go ahead and just delete that or discard
my changes so we'll go ahead and do that
it'll ask me if I really want to do that
and of course I'll say yes and it's up
its now we go up here you can see well
now let's go to the same group sem
window and actually it's not us today so
subversion our support is preliminary so
this is a preview release the subversion
support is not at the same level as the
CVS version but it's coming along very
nicely people are starting to use it
actually so that's it's going to be very
nice when we're done with 15 and 2 point
0 so with that will bring up Matt this
is Matt Morris from our tech pubs group
thanks thanks Dave okay
hello everybody I'd like to talk to you
a bit about documentation access and
Xcode and first I'd like to see a show
of hands how many people have used the
documentation window in Xcode oh great I
mean most people have and i'm sure most
others have at least seen it
demonstrated so i'm not going to go
through a point-by-point analysis of the
features what I'd like to do is really
twofold I want to show you tell you
first a little bit about our plans for
documentation integration and second
what I'd like to do is show you some of
the techniques I think are most
effective in getting answers fast to
those questions you have when you're
coding so where are we with
documentation access and where do we
hope to be in the tiger time frame since
Xcode 1 point 0 came out it's had a
documentation window and that's allowed
browsing searching API searching and
full-text searching of the local content
it however wasn't giving you access to
an even larger pool of documentation
which is the documentation that lives at
developer apple com the ADC reference
library so where we're headed now is to
make sure that whenever you're using
Xcode you'll have access not only to the
resources you're used to but the more
expanded resources of the ADC reference
library and those include technical
notes technical qas that are written by
the ADC staff sample code and other
documents as well so we want to make
sure that when you're using Xcode you
always have access to those additional
features another thing that we want to
make sure you have access to is the
latest documentation thanks to
developments in our production
techniques at Apple we're able to update
the documentation on
much more frequent basis than we have in
the past this is on the order of days or
weeks at most so the latest
documentation is also on the web and we
want to make sure you're looking at the
latest when you're in Xcode so that's
the direction we're headed what I'd like
to do now is show you through a series
of scenarios what I think are some of
the best features of documentation
access those features that will get you
your answers most quickly and just to
set the stage a little bit why is it
important to have good strategies for
getting to your answers given the amount
of documentation that we put on the
local disk it's very important the
normal installation has over 500
documents from single pages all the way
up to publishable books and in addition
to that it has reference for over 40,000
individual api's not counting the Sun
documentation that if you install Java
doc you'll have another perhaps 40,000
api's documented as well so that terrain
is vast and it's really important to
know how to get to those answers fast so
I'd like to show you a few scenarios
okay the first scenario is very simple
you're new to Xcode you start it up what
do you do now some programmers will dive
ahead and just see how far they get with
their intuition others will perhaps want
some help and the help menus the way to
do that Xcode help brings up the
documentation window and focuses on the
help documentation now first a note
about the window itself as you notice
it's laid out a lot like the project
window with a groups column that shows
the documentation group a search field
at the top and an area for the results
the detailed view and below that the
content view and the content now shows
Xcode help so you might start there and
read through some of the help
documentation but what if you want
instead to look at demo I mean tutorial
information way to do that would be to
run the search so we're going to search
for xcode tutorial here's the first
take-home point for this demo the
searches are scoped buys the selected
documentation set so right now we're all
set to run an Xcode tutorial search of
the Xcode code help documentation that
may be a little too specific so you
might want to choose a more general area
like tools but i really suggest that if
you have no idea how the documentation
is laid out or organized just select the
top item the library that's all your
installed documentation and execute your
search
it goes out searches all the
documentation or index of all the
documentation and it comes back here
with a quick tour of Xcode which looks
like a good place to start if you want a
quick introduction now one thing I'd
like to point out it might may be hard
to read back there but up here we have
what's known as a breadcrumb path and
this is the path in the hierarchy of
documents leading to the document you're
looking at so if you find a search takes
you into deep you may want to click up a
level here's everything about tools in
Xcode and more generally tools and so on
so you can go up to a more general level
quite easily and of course like in the
code editor you can use the back forward
buttons to get to back to previous pages
okay let's say instead of being
absolutely new to Xcode you're new to
this version 1.5 or two point oh and you
haven't yet looked into its new features
what you should do is take a look at the
release notes and you can always get to
them through the help menu but I'd like
to suggest a new place to look and
that's over here bookmarks this is new
and the seeds that you have a bookmarks
folder and by default is populated with
a number of useful sites including the
release notes so here we have the
release notes and you might get to them
that line one thing I wanted to say I
skipped something I want to point out
the current documentation on your disk
is much more web aware than it has been
in the past and we're moving more and
more in that direction you'll find as
you browse through these pages that many
of the links will take you directly to
the website so you will be able to get
to the tech notes and q and A's they
don't live on your disk they lived on
the website that the content will take
you there another change that we made is
we're making use of the website for
or the PDF content rather than install
over a third of the gigabyte of
documentation in PDF format on your
local disk which we've done in the past
we're now relying on the website for
that content so the links in your pages
here will take you to the website for
those PDF documents now don't worry okay
that's good for some of you that's good
for some of you it may not be so good
you like the PDF and you want them
locally so we're making those available
to you as a package and you can get that
at the developer website so you can
still have them locally if you want okay
so let's look at a different scenario
and that is you're using Xcode you've
built a project and you're in the code
and you need some help they've mentioned
this in the previous part of this talk
that option double-click is the quickest
way to get from a system API in your
code to the related documentation so
option double-click is another take home
point if you're not using that now
please remember option double click
quick way to get to the documentation a
couple things about our reference
documentation as you can see it's
heavily interlinked hyperlinks so you
can get to the type for that a method
takes and you can easily motor around
through the documentation a couple other
navigation notes up here where you have
a function pop up in your code editor
here we have a similar use this shows
you all the API that's documented on
that page it also shows you some of the
high-level headings in the page to help
orient you and you can not only get a
summary of the page this way but of
course navigate to the individual api's
ok
all right now one thing I want to
mention when we did that option
double-click jump to this page what
really happened is we went up here
automatically Xcode took your selection
stuck it up in the search field mates
made sure it's on the API search mode
and did the search and of course you can
use this manually I don't mean to do
that you can type in whatever string you
want and it will give you all the
completions in the API and that is again
scoped buys the group in the upper left
here library so we see we're getting
java objective-c and any other C and C++
API is that we happen to have by so
selecting a different group let's say
Java you'll filter that down to just the
Java API or four carbon you would have I
guess we have no window wheels but we
definitely have window prefix api's if
you forget I hope you don't but if you
forget option double click you can still
use the context menu to get there we
have fine selected text in API reference
that's equivalent to option double click
and of course you can do a full text
search it by using that menu okay if
you're doing objects oriented
programming as Dave pointed out earlier
you can use the class browser to get
around your classes and these classes
are all system classes so they have
associated documentation just click the
blue book and you can get to the
documentation or to any individual
method in that page the other thing you
can do if you're writing a tool is they
using unix commands make sure you know
about the open man page panel you can
both get to a man page by name or do a
search
for example grep let's do a search for
all man pages that have that actually is
doing an apropos search and here are
some of the results your man pages of
thank you your man pages appear in HTML
and they're all hyperlinks so you can
get back and forth all right one last
scenario not about the code about the
IDE okay you're working in the IDE and
you have a question let's say you're
using one of these inspectors take it a
note that we have help buttons in the
bottom right corner now and by clicking
those takes you directly to the
appropriate documentation this is fairly
new so we don't have them everywhere we
want them to be but we're working in
that direction so take a look for these
links to the documentation okay next can
we go back to the slides next I'd like
to talk to you about a different subject
in that scripting in Xcode Xcode is
accessible to made accessible to scripts
in a number of ways you can use Apple
scripts to automate operations in Xcode
you can use build scripts bill phase
scripts to intercede in the build phases
worksheets and user scripts and I'll
talk about those in more detail okay
applescript of course you be aware that
with apple script you can run an
application by remote control and with
applications you can do as much as their
applescript dictionaries allow you to do
xcode dictionary is not complete by any
means but it has a lot of important
functionality that you can use right now
for example in the seeds that you have
there's the import command so you can
batch import codewarrior projects into
xcode or if you want to set build
settings on a number of projects you can
do that as well and that's what the code
up there is showing and of course you
can automate the build process hello
bill phase scripts I won't go into this
because the next session that's in this
room at three-thirty goes into the build
system in detail but bill phase scripts
let you interpose your own set of
operations in the standard set of build
operations like compiling and linking
and you can have scripts that would do
any of these kinds of operations such as
logging the progress of the build and
you can write build phase scripts in any
of the supported languages like shell or
parole worksheets those of you that used
mpw or familiar with this no doubt this
is a functionality that lets you select
a command in a code editor and executed
as if you'd gone out to the terminal and
typed it in we'll take a look at that in
a second and finally user scripts let
you add to the command set the menu of
Xcode commands of your own description
and we have a number of default ones
there for you to get started with now at
the bottom of the slide you see where
these scripts live take a look at the
documentation on user scripts and it'll
explain this but you can our default
ones live in the flash library location
and you can override them by putting the
scripts in your tilda library location
okay so let me show you a little bit
about scripting an Xcode first I'd like
to show you worksheets
it's a very simple idea you have a
command in your code editor like this
one simply listing the root directory
hit ctrl R and that the command is
executed and the results come back into
the code editor now why would you need
that functionality what kinds of uses
can you put it to I'll tell you one that
i've i've used is when i was debugging a
bundle that my application was using I
would have different versions of the
bundle and I would load one or the other
depending on a default setting and
rather than type in the default command
each time I could just execute it here
restart my app and it would load the
other bundle there are a lot of
different suggestions here for things
you might do some of them are written in
UNIX utility command some of them like
sample or default some of them are
written in perl i so you can get this
sample worksheet at the developer
website this evening i believe the disk
image of this session will include it
here's what I'd like to run for you I
think anyone in San Francisco any
programmer should know where all the
local earthquakes are this one has just
gone out and told us where the ones that
occurred in the last two days are it
looks like we're pretty safe so let's go
on what I'd like you what I'd like to
show you now is the script user scripts
menu that's up here and by default it
has a lot of useful command let's take a
look at some of them
one that I use all the time is the
comment uncomment command and if you
haven't used it I suggest give it a try
it's bound to the command / key and you
can easily take a section of code out of
out of service that way another one that
I think is quite useful especially for
Objective C programmers if you have
instance variable and you want to set up
some access or methods just select the
instance variable go to the code place
access or declarations on clipboard
command and paste in the accessors and
there's an equivalent one for the
definition thank you there's another
suite of commands i think you should
know about and that's the header doc
sweet and i'd like to show that those
quickly this header doc is like Java doc
it allows you to put structured comments
in your headers and then run them
through the utility and generate HTML
documentation so let's do that quickly
here here's our class lits class
declaration let's put in a class
template so it's parsed the class and
super class we just put in this method
let's add the method template for that
and again it parsed out the parameter
save the file because header doc works
with save files on disk and then view
the header doc for this header what will
happen is it went out rent header doc on
that header here's our class and here
the methods the ones that I had already
marked up and the new one that we just
put in so it's a very quick way to get
some good looking documentation for your
classes
okay so that's all I'd like to say about
user scripts do take a look at scripting
in general and see how it will increase
your productivity with Xcode so we're
running a little late i'm not going to
summarize everything that came before i
would like to point you to these
references in the installed
documentation and xcode help and
especially as a quick tour that we saw
earlier i think would help you remind
you of some of the techniques we talked
about today and with that I would like
to bring up I don't think Matthew
formica but a virtual Matthew Wiley
Hodges thank you
[Applause]