Creating a new iPhone project
Xcode is the development tool for creating iPhone applications. It is also used to creating applications for Mac OS X operating system. Once you installed the Xcode tools, you can run it from Developer\Applications folder (default location for installation); or, you can drag it on to the dock for quick use.
Xcode is like Visual Studio and Eclipse, if you are used to developing with those tools. Visual Studio is used for developing applications for Windows, Web, etc. The primary programming languages there are C#, VB.NET and C++. And, you would use Eclipse primarily as a development environment for Java programming language (though, it is used for a whole lot of other languages and tasks).
So, in summary, you would use these three development tools for developing applications for three different phones:
- iPhone -- Xcode Tools
- Android -- Eclipse
- Windows Mobile -- Visual Studio
Using a Template for the iPhone application
By using templates for a project, you can create a certain type of iPhone application quickly. From the Xcode menu, choose File - New Project to open the New Project templates window.
Figure 1. iPhone New Project Template Dialog Box. The iPhone OS has a smaller set of templates compared to building applications for Mac OS X.

As you can see, there are two sets of templates in the New Project dialog box:
Xcode can be used to develop applications for both iPhone OS and Mac OS X. The number of new project templates available under Mac OS X far exceeds the templates available for iPhone OS.
In this Xcode (version 3.1.1), following templates are available are available for an iPhone application:
- Navigation-Based Application
- OpenGL ES Application
- Tab Bar Application
- Utility Application
- View-Based Application
- Window-Based Application
The iPhone applications are developed using Objective-C programming language. However, for Mac OS X applications, several other new project templates for different languages exist. For example, C++, Python, and Ruby can be used for developing Mac OS X applications, in addition to the usual Objective-C.
A Navigation-Based Application
For this example, the template “Navigation-Based Application” is selected. And it is saved as “FirstApp”.
Figure 2. First iPhone Application. By default this project and its content are saved into the Documents folder (which, of course, can be changed)

The Project Window
Depending on the chosen template, a project with a set of source files will be created and opened in the project window. In the project window, you will see the header files (with .h extension), implementation files (with .m extension), user interface files (with .xib extension), property file (with .plist extension) and others.
Figure 3. The project window. It contains a navigation section of Groups and Files on the left, a detail window at the top and a code / editor window at the bottom.

By default, you can see the files in this FirstApp project separated into following groups:
- Classes
- Other Sources
- Resources
- Frameworks
- Products
The header files (.h) and implementation files (.m) that declare and implement classes are shown under Classes group. The main() method and precompiled headers are shown under Other Sources. Resources are user interface files and other information files. Frameworks are the libraries that contain the Cocoa code. These files have .framework extension (CoreGraphics.framework, UIKit.framework, Foundation.framework, etc.).
This placing of source files into different groups (like Classes, Other Sources, etc.) can change from project to project (template to template). You can create your own groups as well, according to what makes sense for a particular project.
Compiling the iPhone Application
If you click on the Build and Go button, the project files will be compiled and the application will be opened in the iPhone simulator.
Figure 4. The compiled iPhone application in the simulator. This is a Navigation Based Application; hence it has a navigation bar at the top and a TableView. Since no data has been added, this view is empty.

As you can see, this is an empty list application. The user interface for this list comes from the RootViewController.xib file. The class that supports the functionality is defined in the RootViewController.h header file. In this file, you can see the RootViewController class is derived from the UITableViewController and that class provides the basic list/table user interface you see in the above picture.
Figure 5. The default icon for iPhone First App is in the main screen of iPhone. Since no special icon is made for this application, an empty/default white icon is shown.

Clicking on the icon for the First App, that application will be started again. However, going to the home screen on iPhone (by clicking on the button at the bottom), the Xcode will close the debugging mode. If you start the application again from the iPhone Simulator, the application is not in the debugging mode automatically.