XCode Tutorial: Create Our First XCode Project

Updated Oct 3 2013: This tutorial is compatible with XCode 5 AND XCode 4!

We’re taking a practical approach to learning iOS programming. This means lots of hands on work and practice!
In order to benefit the most from these lessons, you should open XCode and try to follow along.

This is part 2 of the lesson plan. Click here for the entire Learning Plan.

Tools Required and Costs

To recap from the introduction video, all you need to get started:

1. A Mac with XCode (XCode is free).
2. An Apple Developer Account (Free to register but costs $99 if you want to test on a device and publish to the App Store).
3. The will to learn the Objective-C programming language and how to use XCode.

If you don’t have a Mac and you don’t want to buy a new one, have you considered the following options?

1. Can you borrow a friend’s Mac?
2. Do you have access to a computer lab with Macs?
3. Buying a used Mac Mini?

Aside from option #1 and #2, buying a used Mac Mini is probably the cheapest way to start. A brand new Mac Mini is $500 and you can get a used one from Craigslist/eBay for half the price.

Difference Between XCode and Objective-C

I see a lot of confusion between learning XCode or Objective-C for building iPhone apps. The distinction between the two is that XCode is the application that you will be writing your code in and Objective-C is the programming language you will use to write that code.

So the majority of your learning will be around programming concepts and the Objective-C programming language but because we’re doing all of that inside of XCode, you’ll learn how to navigate and use XCode as a result.

Getting XCode

XCode is available for free in the Mac App Store!

Creating a New XCode Project

When you launch XCode for the first time, you’ll see a welcome screen like below. Just click on “Create a new project”

Next make sure that you’ve selected “Application” under “iOS” on the left hand side. On the right hand side, you’ll all of the different app templates you can use to start your project.

You’ll want to select “Single-View Application” and click OK.
Next, XCode will ask you for some basic pieces of information to start your project.

XCode 5 new project settings screen

Project Name: You can fill in whatever you want to call your project. Mine is “BlankDemo”

Organization Name: This is optional. At the top of all your files, it will say “CompanyName” if you don’t fill this in.

Company Identifier: This is to identify your app. You can fill in com.companyname. Your app will turn out to be com.companyname.projectname.

Class Prefix: You can leave this empty. If you fill this in, all new files you create will be prefixed by this prefix in order to distinguish the files you created from files originating from other sources.

Devices: You can leave this set to iPhone for now.

If you’re using XCode 4, you’ll see the additional options below. These options are selected in XCode 5 by default.

XCode 4 new project settings screen

Use Storyboards: Storyboards are a way of constructing navigation flows within your app and in XCode 5 this is on by default so make sure this is selected if you’re using XCode 4 for the sake of following along.

Use Automatic Reference Counting: This should be selected because otherwise, we would have to manage the disposal of objects ourselves which is somewhat of a more advanced topic.

Include Unit Tests: For the demos we’re building, we don’t need this included. Unit tests are a way of writing test cases for your app so you can efficiently test your app after every change to make sure nothing was broken because of the changes.

Once these settings are in place, click “Next” and you’ll be presented with your newly minted XCode project!

Running Your XCode Project

At this point, we won’t write any Objective-C code. Let’s just run the XCode project as is and see what shows up!

Click the Play icon in the upper left hand corner of the XCode interface.

Now the iPhone simulator will launch and show you a grey screen.

Congratulations! You’ve compiled your very first XCode project and run it!

In the next tutorial, we’ll be adding to the user interface to display something on the screen!

Click here to go to the next lesson now!

Frequently Asked Questions

There are none right now but if you have a question related to this tutorial, please ask it in the comment section and i’ll add your question and my answer in this section!