Xcode is the software used by developers to create applications to Mac OS X and iOS. Part of learning how to develop apps in Objective-C and Cocoa is getting to grips with Xcode – Xcode is a huge piece of software and even after using it for years, there are still some features that I’m sure I don’t know exist. The purpose of this article is to get you up and running with the basics of Xcode so that you’ll be able to access vital areas of the application when you’re making your own apps.
Creating a Project
The most important thing to get to grips with when creating an app is obviously how to get started with making your app come to life – this means getting your head around the process you need to follow and also what template to choose when you’re starting off.
To create a new project, open up Xcode and go to File – New – New Project… (CMD + Shift + N) and then you’ll be presented with a variety of different project templates to choose. The question is which one do you choose?
- Navigation-Based Application. An application that presents data hierarchically, using multiple screens. The Contacts application is an example of a navigation-based application.
- OpenGL ES Application. An application that uses an OpenGL ES–based view to present images or animation.
- Tab Bar Application. An application that presents a radio interface that lets the user choose from several screens. The Clock application is an example of a tab bar application.
- Utility Application. An application that implements a main view and lets the user access a flipside view to perform simple customizations. The Stocks application is an example of a utility application.
- View-Based Application. An application that uses a single view to implement its user interface.
- Window-Based Application. This template serves as a starting point for any application, containing an application delegate and a window. Use this template when you want to implement your own view hierarchy.
Once you’ve chosen a template that you think best fits your app, press Next and you’ll be taken to a page in which you have to enter some information about your app.
The Product Name is essentially the name of your application although this can be changed, you should generally try to choose something that you’re going to stick with.
The Company Identifier should correspond with your Bundle Identifier set up Provisioning Profile and generally follows the convention of com.COMPANYNAME.
You can leave the Class Prefix empty unless you’re required by your client/boss to add something. This generally adds the prefix to the name of all the files you create so you can easily identify who made them.
The Device Family is pretty standard, you can choose to make an app for iPhone, iPad or Universal. Universal means that you’ll be able to make an app that works with both iPhone and iPad.
Use the navigator selector bar to choose the navigator best suited to your current task:
The Assistant Editor
Assistant has two modes: tracking (or automatic) mode and manual mode. Tracking mode has several criteria from which you can choose, such as counterparts, superclasses, subclasses, or siblings. Assistant selects the file or files that best meet the selected criterion and opens those files in the Assistant pane of the source editor. In manual mode, you select the file to display in the Assistant pane. You can also split the assistant editor pane to create multiple assistant editors.
Assistant opens a second pane in the editor area of the workspace window. For source files, the default behavior for Assistant is to display the counterpart of the file displayed in the standard editor pane. That is, if you’ve opened an implementation file, Assistant displays the corresponding header file, and vice versa. You can choose any of several other possible criteria to be used by Assistant using the Assistant pop-up menu. The Assistant pop-up menu is the first item in the path shown in the jump bar above the assistant editor. To do so, open the pop-up menu and choose an item. The choices offered depend on the type of file being edited.
Selecting a file in the project navigator causes that file to be shown in the normal editor pane. Option-click when selecting a file in the project navigator or hold down the Option key when selecting a file in the jump bar to display that file in the Assistant pane rather than the standard pane. Doing so switches Assistant to manual mode.
The assistant editor pane can be displayed to the right of the standard editor pane or below it. Choose View > Assistant Layout to switch between a vertical or horizontal split for the editor panes.