

Make changes to the program shown in the edit window to match Program 2.1. You can edit your file inside this window. The right pane of your Xcode project window shows the contents of the file called main.m, which was automatically created for you as a template file by Xcode and which contains the following lines: // Table 2.1 lists other commonly used filename extensions. m as the last two characters of the filename (known as its extension). Then you can decide how you want to work with your programs throughout the rest of this book.įigure 2.7 File main.m and the edit window Let’s go through the sequence of steps using both methods. You can both compile and run your program using Xcode, or you can use the Clang Objective-C compiler in a Terminal window. Program 2.1 // First program exampleīefore we go into a detailed explanation of this program, we need to cover the steps involved in compiling and running it.


Without further ado, Program 2.1 shows an Objective-C program to accomplish this task. To begin, let’s pick a rather simple example: a program that displays the phrase “Programming is fun!” on your screen. We want you to understand the steps involved in keying in a program and compiling and running it. You won’t work with objects just yet that’s the topic of the next chapter. In this chapter, we dive right in and show you how to write your first Objective-C program.
