{infiniteZest}
// Articles. Tutorials. Utilities.
Home  |   Search  |   Login  
Categories Skip Navigation Links
New / All
AJAX
Apple
ASP.NET
.NET
Git
Google / Android
Python / IronPython
Miscellaneous
SQL Server
Understanding the Workspace of an Xcode project
Summary
This article discusses various parts of the Project window inside an Xcode project. It also gives a quick overview of the Groups and Files navigation window. The Run menu, the default toolbar, and the built-in source editor are also discussed.
 
Table of Contents

The Project Window

Figure 1. The Project Window of Xcode with a simple iPhone application open. The Source Editor shows the main.m file which contains the main() method, where every applications starts its execution.

Menu

Figure 2. The Run menu of Xcode. You can run an application without stopping at the breakpoint, debug, or start the application with a performance tool like Instruments.

Toolbar

Figure 3. The Toolbar and the additional items that are available for the toolbar. All this functionality is available from the main menu.

Figure 4. The Overview box from Xcode toolbar. Includes current SDK used to compile the application, current configuration, current target made out of the application, which version of the simulator and the CPU architecture.

Groups and Files

Figure 5. The Groups and Files window of Xcode. This window lists the header files, implementation files, user interface files, as well as the frameworks used and the targets compiled.

Details

Figure 6. Details window of Xcode development tool. This screenshot shows that there are 3 errors in the main.m file.

Source Editor

Figure 7. The Source Editor in Xcode. Code is color-coded. In the figure below, error (ffint type) is introduced to show message bubbles right in the editor, where the error has occurred.

 
Article Series
Previous Article:
Test Your Knowledge: The directory structure and file types of iPhone application projects explained
This article is part of the Series:
Article Series: Getting started with iPhone development
Next Article:
Test Your Knowledge: Understanding the Workspace of an Xcode project

The Project Window

Xcode is used to develop iPhone / iPod touch and Mac OS X applications. The main window of Xcode development tool is the Project Window or the Workspace Window. From here you can manage and develop your application.

Figure 1. The Project Window of Xcode with a simple iPhone application open. The Source Editor shows the main.m file which contains the main() method, where every applications starts its execution.

Figure 1. The Project Window of Xcode with a simple iPhone application open. The Source Editor shows the main.m file which contains the main() method, where every applications starts its execution.

Menu

As is the standard for Mac applications, menu is at the top of the screen. Probably the most commonly used menu items are File - New Project for creating a new project, File - New File for adding a new file to the project, the menu items in Build and Run, and accessing documentation from the Help menu.

Figure 2. The Run menu of Xcode. You can run an application without stopping at the breakpoint, debug, or start the application with a performance tool like Instruments.

Figure 2. The Run menu of Xcode. You can run an application without stopping at the breakpoint, debug, or start the application with a performance tool like Instruments.

Toolbar

The toolbar of Xcode is pretty slim. The two big toolbar icons you would use are Build and Go (for running an application after you have made some changes to the source) and the red Tasks button which you can use to stop the application when its running.

However, you can right-click on the toolbar to choose Customize Toolbar. It will show a whole list of items to be dragged and dropped on to the toolbar. Contenders for the small amount of space could be Breakpoints and Debugger icons. Though, these and all the other items on the toolbar are available from the top menu.

Figure 3. The Toolbar and the additional items that are available for the toolbar. All this functionality is available from the main menu.

Figure 3. The Toolbar and the additional items that are available for the toolbar. All this functionality is available from the main menu.

The Overview box from the toolbar provides a great way to build and test the application for various configurations.

Figure 4. The Overview box from Xcode toolbar. Includes current SDK used to compile the application, current configuration, current target made out of the application, which version of the simulator and the CPU architecture.

Figure 4. The Overview box from Xcode toolbar. Includes current SDK used to compile the application, current configuration, current target made out of the application, which version of the simulator and the CPU architecture.

Most of the time, you would use Simulator | Debug setting while developing the application. Meaning, you will be testing the application on the iPhone Simulator and it would be a Debug build. With Debug build, you would be able to stop the execution and find out the values of the variables (and do other tasks useful for debugging an application). In a Release build, the compiler optimizes the code; and the debugger won’t be able to find out the values of variables (and other things useful during debugging).

Groups and Files

Xcode comes with a navigation window on the left. This window lists all the files that are part of the project for this application. This window is called Groups & Files, as the files of the project are grouped into various useful and convenient categories.

Figure 5. The Groups and Files window of Xcode. This window lists the header files, implementation files, user interface files, as well as the frameworks used and the targets compiled.

Figure 5. The Groups and Files window of Xcode. This window lists the header files, implementation files, user interface files, as well as the frameworks used and the targets compiled.

Underneath the Frameworks group, you can see Foundation.framework and UIKit.framework. You can expect to see these two frameworks in most of the iPhone applications. CoreGraphics.frameworks provides classes for colors, fonts, images, etc. For Mac OS X applications, you get most of the basic UI functionality from AppKit framework. On iPhone applications, that has been replaced by UIKit.framework.

Under NIB Files Group in Xcode, you will see the .xib files for the iPhone application. These .xib (x for XML, ib for Interface Builder) files can be edited with Interface Builder. These file will become .nib (n for NextStep, ib for Interface Builder) files in .app bundle generated for this iPhone application.

The Objective-C implementation files are shown under the Implementation Files group. These are the files with .m extension. The header files that contain the declaration of the class to be implemented will have .h as extension.

In addition to the current groups that are shown in the Groups & Files window, you can create your own custom groups by using Add - New Group from the right-click menu. This provides a way to organize the source files.

Details

The Details window provides the details of the files shown in the Groups and Files window. These details include file type, path, build status, errors, warnings, SCM, target, and comments.

Figure 6. Details window of Xcode development tool. This screenshot shows that there are 3 errors in the main.m file.

Figure 6. Details window of Xcode development tool. This screenshot shows that there are 3 errors in the main.m file.

Source Editor

The Source Editor included in Xcode is very powerful and has all the things you would expect from a source code editor: color formatting of the code, line numbers, code folding, code sense (help while coding), message bubbles for errors, navigating to different source files, navigating to different parts of the code, setting breakpoints, etc.

Figure 7. The Source Editor in Xcode. Code is color-coded. In the figure below, error (ffint type) is introduced to show message bubbles right in the editor, where the error has occurred.

Figure 7. The Source Editor in Xcode. Code is color-coded. In the figure below, error (ffint type) is introduced to show message bubbles right in the editor, where the error has occurred.

Xcode offers a GUI debugging window and a debugging console where GDB (GNU Debugger) commands can be executed. In addition, breakpoints can be set/disabled/deleted right from the source editor. Right from the source editor, you can find out the values of the variables by moving the cursor over. A small set of debugger icons like Step Into, Step Over, Continue are also placed on top of the source code window. All this together provides a great way to debug the application right from source editor.

Take a Quick Quiz on this Article

1. TRUE or FALSE: Debugging can be performed from the source editor window of Xcode



: Debugging in Xcode can be done from several places
Question 1 of 5
Article Series
Previous Article:
Test Your Knowledge: The directory structure and file types of iPhone application projects explained
This article is part of the Series:
Article Series: Getting started with iPhone development
Next Article:
Test Your Knowledge: Understanding the Workspace of an Xcode project
Bookmark and Share This

More Articles With Similar Tags
This is a test on the article that gives a quick overview of the development tools installed with iPhone SDK. These tools include Xcode, Interface Builder, Instruments, and iPhone Simulator. In the article, Dash Code, which is used to build web applications for iPhone is also introduced. GDB, the open source debugger, is discussed there as well.
This is a test on the article that discusses various parts of the Project window inside an Xcode project. It also gives a quick overview of the Groups and Files navigation window. The Run menu, the default toolbar, and the built-in source editor are also discussed.
icon-xcode-interface-builder-connection-panel.jpg
This article explains the user interface files of an iPhone application. Explains the contents of the .xib files, which store the user interface. Goes through the various windows (Document Window, User Interface Window, Inspector Window, Library Window, Connections Panel) of the Interface Builder. The example used is a simple navigation-based iPhone application.
This is a test on the article that explains the user interface files of an iPhone application. It explains the contents of the .xib files, which store the user interface. Goes through the various windows (Document Window, User Interface Window, Inspector Window, Library Window, Connections Panel) of the Interface Builder. The example used is a simple navigation-based iPhone application.
This is a test on the article that looks at debugging Objective-C code of an iPhone application from Xcode. Debugging in Xcode can be performed from these four different places: Code Editor Window, Debugger Window, GDB Console, and Mini Debugger. This article goes through these four different ways.
About  Contact  Privacy Policy  Site Map