Monday, April 04, 2011

WWDC2010 Session307 Introducing Xcode 4

Xcode 4 is an all-in-1IDE just like Visual Studio (I have used Visual Studio for more than 10 years. Comparing to Visual Studio, Xcode 3 is not convenient. Fortunately, Xcode 4 changed it). Interface builder is no longer a separate application. You can write code, design UI, debug in Xcode 4. This session covers workspaces, navigation, editing, organizer, version editor, debugging and schemes.

Xcode4

Workspaces

The workspace is similar to Visual Studio's solution. A workspace works as a container(actually it just references files). You can add several projects into a workspace. Visual Studio 2001 supported the solution. Xcode supported the similar thing 10 years later. The difference is Xcode 4 does not force you to create a workspace. You can open a project directly in Xcode4. But you have to create a solution in Visual Studio even if it contains only one project.

Projects can be shared between workspaces. Every workspace has its own index, build folder.

Navigation

The left panel of Xcode 4 contains several navigators.

1. Project navigator - shows all projects and files

2. Symbol navigator - shows class hierarchies, members, functions

3. Search navigator - find and replace

4. Issue navigator - shows warnings and errors

5. Debug navigator

6. Breakpoint navigator - shows breakpoints

7. Log navigator

Editing

There are three types of editing behavior. You can see 3 buttons on the right side of the toolbar.

1. Standard - nothing special, similar to Xcode 3.

2. Assistant - There will be two editors. If you select a .h file, the .m file will show on another editor. This feature is very convenient.

3. Version - Xcode 4 includes a version control client. You can check the file's history in Version editor.

When you are writing code, Xcode 4 compiles your code in the background and shows the error. Sometime, it tells you how to fix it.

Xcode 4 provides Code Snippet library. You can add you snippets, define shortcuts and use them.

For the xib files, you can right-click and drag a control into .h file to create an IBOutlet or IBAction.

Xcode 4 can open any file in hex mode and edit it.

Organizer

1. iPhone tab - similar to Xcode 3.

2. Repository tab - shows code branches.

3. Projects tab - shows the projects and the snapshots.

4. Archives - shows the archives used to submit apps to app store.

5. Documentation tab - Documentation is now integrated into Organizer.

Version Editor

In version editor, you can compare your current modification with the server version and see the history of a file in log view.

Debugging

The new debugging UI looks like Visual Studio.

Scheme

Scheme is a plan for Xcode to produce a result from your projects and contents of your workspace.

Xcode 4 schemes could come with 3 phases: build, test, launch. It is good for your workflow. You can create a scheme for bug fixing: debug build, unit test, launch in debugger. You can also create a scheme for performance testing: release build, performance tests, launch in Instruments. And you can create a distribution scheme: release build, unit tests, archive.

Sample projects mentioned in the demo:

Sketch (apple sample project), Baffle(no source code)

The authors of WWDC2010 Session307 Introducing Xcode 4:

Anders Bertelrud - Xcode Architect

Brooke Callahan - Software Engineer

Ron Lue-Sang - Senior Software Engineer

No comments: