Creating first console app using Xcode

25 Aug

In this post we shall learn to how to create our first console based project using Xcode.

To launch Xcode perform the following steps

a) Go to Finder.
b) Select the MacintoshHD or what ever name is given to your drive.
c) Over their you shall see a folder called as developers.
d) Inside that folder kindly select the application group.
e) Inside the application group you can locate the Xcode icon.

Click that icon and Xcode will be launched with a small icon present inside the dashboard. In the Xcode menu select the File option and from the file submenu option select the create new project option

This shall open the screen given below:

In the above screen their are two templates one for creating mac os related application and the other is for creating the iPhone applications, but since we are very new to objective c so in that case we have to first practice objective c on console based application, so from the mac os template select applications and from their kindly select the console based application which shall open a menu in front of you asking you what the project name should be so give your project an appropriate name.

Now after giving the project name you will see that a project has been created for you will see lots of files and folders which will not make any scenes on first view. For beginning just remember that the blue file at the top is called as the xcode project file.

Right click this file where you will see a list of options from their select the add -> new file option look at the image given below for more options

After that add the objective c class into the application with a proper name make sure that this objective c class is the subclass of the NSObject class, and when you do that their will be two files that will be added into the project with the extension .h and .m (yourclassname.h and yourclassname.m)

The name of my class is Calculator so their will be two files which will be added into my file that would be Calculator.h and Calculator.m

In the above image you can see a view of the .h file where you will be declaring your methods and variables, now lets have a look at the .m file

In the above image you can see the structure of the Calculator.m file where you will be implementing all your methods declared inside the Calculator.h file, the methods will be implemented between the @implementation and @end directive.

I hope that this post has helped you out in learning how to create you first xcode project, you can download the sample project from here and if you are having any questions or queries regarding the working on Xcode then feel free to contact me at or mention your doubts as comments.

Leave a comment

Posted by on August 25, 2011 in Beginners


Tags: , , , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: