Getting started with Xcode

Xcode is Apple’s Integrated Development Environment. That means that everything you need to write, build, and run new applications is in Xcode.

A note on terminology: anything that is executable on a computer we call a program. Some programs have graphical user interfaces; we will call these applications.

Some programs have no graphical user interface and run for days in the background; we call these daemons. Daemons sound scary, but they aren’t. You probably have about 60 daemons running on your Mac right now. They are waiting around, hoping to be useful. For example, one of the daemons running on your system is called pboard. When you do a copy and paste, the pboard daemon holds onto the data that you are copying.

Some programs have no graphical user interface and run for a short time in the terminal; we call these command-line tools. In this book, you will be writing mostly command-line tools to focus on programming essentials without the distraction of creating and managing a user interface.

Now we’re going to create a simple command-line tool using Xcode so you can see how it all works.

When you write a program, you create and edit a set of files. Xcode keeps track of those files in a project. Launch Xcode. From the File menu, choose New and then New Project….

To help you get started, Xcode suggests a number of possible project templates. You choose a template depending on what sort of program you want to write. In the lefthand column, select Application from the Mac OS X section. Then choose Command Line Tool from the choices that appear to the right.

Figure 2.1  Choosing a template

Choosing a template

Press the Next button.

Name your new project AGoodStart. The company identifier won’t matter for our exercises in this book, but you have to enter one here to continue. You can use BigNerdRanch or another name. From the Type pop-up menu, choose C because you will write this program in C.

Figure 2.2  Choose options

Choose options

Press the Next button.

Now choose the folder in which your project directory will be created. You won’t need a repository for version control, so you can uncheck that box. Finally, click the Create button.

You’ll be creating this same type of project for the next several chapters. In the future, I’ll just say, Create a new C Command Line Tool named program-name-here to get you to follow this same sequence.

(Why C? Remember, Objective-C is built on top of the C programming language. You’ll need to have an understanding of parts of C before we can get to the particulars of Objective-C.)

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset