programming

Xcode For Beginners

EDITOR'S NOTE: This article was written before new, amazing SDK's were released such as Corona SDK. Other posts will address Corona as a better place to start.

I believe anyone wanting to learn programming should start with the basics, and that means the C language. It also means no graphics so the focus is on the language itself and understanding just the language, and not an IDE or environment like Flash. You can do plenty of good learning just by using text mode.

Here is a step-by-step walkthrough of how to get Xcode set up for programming simple console apps like you would find in any basic C book.

STEP 1: Install Xcode 4

It's in the Mac App Store. Search for Xcode then get it. I believe it's free. Next, after it's downloaded, you need to run the app called "Install Xcode" (if you're running Lion, you can find it by clicking the silver rocket ship dock icon). That is what will really install it. When that's done, you can move on to step 2.

STEP 2: Create a New Project

This is the first thing you will see. Make sure you choose "Create a new Xcode project".

 

Next, choose "Mac OS X", then "Application".

Then choose "Command Line Tool". Click Next.

 

Now choose the options for your project, and where to put it.

Click Next.

 

Make sure to UNCHECK the option to create a git repository. You're just starting to learn to code - source control can come later.

 

STEP 3: Set Up The Project Window

Now the project will start up in a window that will look confusing since you're not used to this kind of information. Don't worry — you don't need to know about this yet, and you can get rid of it so you can focus only on your code.

First, select your main.c source by clicking on the name in the left pane.

 

Next, let's get rid of all the bothersome info. Click on the View buttons so they're all off like this.

 

Now you should be looking only at pure code.

Click on the PLAY button at the top-left to run the simple main() code that was generated for you. It will open up an output window at the bottom of the edit area.

Now, make the output area fill the screen from left to right by clicking the View buttons like so:

 

There! Now you have pure code and pure output!

To clean up the output and make it only show you your code output and no compilation messages, change the pulldown menu from All Output to Target Output.

Finally, I don't like coding with a solid white background blasting my retinas all day, so I always choose a dark scheme.

To do this, press Command-, (comma) to bring up Preferences. Choose Fonts & Color. On the left pane, choose the theme Midnight. Your screen would look just like this...

 

That's all there is to setting up a new console-only C project in Xcode with a simple environment! This is the view that my girlfriend Brenda prefers because it's easy to just focus on her code.