3. Starting and understanding what's in a new Xcode project

Now that we have a solid grasp of the basic types of data that we can use, let's go ahead and start a project to put our knowledge to use. Go ahead an start Xcode (I will be using version 4.2), and select the option "Create a new Xcode project" on the left. This will take you to the new project screen that shows you all of the different templates you can start from. That is one thing that Apple has done really well with the iOS SDK is providing great templates that do a lot of the heavy lifting right from the get go.

I definitely recommend taking a minute to browse through the different project types you can create, and see what they are capable of doing. There is a pretty good chance that at some point down the road you will be using most if not all of the templates from that list. For our purposes today, we are going to select the simple Single View Application. This template sets us up with a single blank view that is ready to be built upon.

In the next screen, go ahead and name your project in the first field (I am naming my project Example, I recommend you do the same), and set that same name in the Class Prefix, and then you probably don't need to worry about the other fields at this point. You can select the device family, which I'm just going to leave as iPhone. As for the checkboxes, select the middle one only, Use Automatic Reference Counting, and hit Next. After you select a destination for your project, hit Create and you are ready to go!

The first view you are greeted with when yo make your new project is a settings page for your application. Notice that off to the left the actual project file is selected. Anytime you want to come back to this screen, select the project file in the left hand side, and you can adjust any settings you need to. Now let's look at the files that come inside of the project, that Xcode has setup for us. You can see that there are some yellow folders called Groups that have different files in them. For the most part, the only one you need to worry about is the one called Example, that is where all of our code files are going to go. Inside of the Example group you can see that there is a nested Group called Supporting Files. That is important to know because that is where you put all of your resources (like images, audio files, databases, etc) that you want to add in the app.

Ok enough with the boring Xcode explanations, lets get into some code! Go ahead and select the name of our first view controller over on the left which is called (in my case) FirstViewController.

Wait a minute, there are two files that say FirstViewController! What gives?

I'm going to explain the difference between the .h file and the .m file in my next post. Stay tuned!

4 comments:

  1. This is phenomenal! I can't believe how easy you're making it to understand the basics of programming by linking what I already know (like basic math) to new information pertinent to programming.

    Zero to hero in iOS development? Awe yeah, baby!

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. It's looking good! However I have a .h, .m, and .xib file. Any update on .xib?

    ReplyDelete
    Replies
    1. Hey Greg! Good to see you on here :) So if you look through the posts on the right, we don't get to .xib files until #13! It takes a while to get there, but we do. Hit me up with any questions you have if the posts aren't clear enough. I've got to crank out a few more before you and Nate master everything on this blog.

      Delete