Setting an iOS Project
Lets begin setting an iOS Project by taking some practical scenarios. For developing the iOS application we need Xcode, which you can get from Apple App Store free of cost. First of all, open Xcode go to File -> New -> Project as shown below
When you select the Project option, Xcode will display the iOS project templates as shown below.
As you can see there are options for iOS as well as for Mac OS X. As we are interested in iOS Apps Development, under iOS we will select Application. Under Application there are 5 templates. We will select the most basic one “Single View Application”. As iOS is UI driven app development there should be at least one view. Thus we opt for this template. When you click next, you will see a form having following fields:
Product Name: Name of the project
Organization Name: Name of the Company
Company Identifier: It is a package name of the company, which is producing the project. Normally we use reverse domain name as com.organizationname”.
You can use upper case and lower case but they are case sensitive, but using lower case is advised.
Bundle Identifier: It is combination of company identifier dot product name (companyidentifier.productname). This is unique to the application. It is changeable during deployment process.
We will see its importance when we deploy the app on the device and on the App Store. It is uneditable at this stage.
Language: Now with Swift been introduced. You have an option whether you can use Swift or Objective C to create the project. One can have few classes with Swift and few with Objective C.
It is drop down with two options – Swift and Objective C
Devices: It is a drop down list having three options – iPhone, iPad and Universal. We will start with iPhone first. Depending upon your requirement you can choose either one of them.
We have field the form as shown below
Product Name: Project1 (Always start the project name with uppercase)
Organization Name: Nimap Infotech
Company Identifier: com.nimapinfotech
Bundle Identifier: com.nimapinfotech.Project1 (auto generated)
uncheck the Core Data check box once you click next, the file browser will be shown.
As shown below, you select the location on your hard drive where you want to create the project.
Once you select the location, press create button, the project gets created on the selected location and Xcode opens up the project as shown below. We will first look at the Xcode IDE and see what iOS templates have been provided. I always believe in learning with observations.
On the top right of the tool bar, you will find three boxes as shown .
Click on them to see what happens!(don’t worry). You have to click the right 3 boxes, which have blue and gray bars. When you play with these boxes you realise that Xcode is divided into 4 major windows namely, Left Window or Navigation Pan: This window shows all the files, which are used in the project. Also it is further divided into 8 tabs each having its own unique
functionality. We mostly use the first tab, which shows all the files of the project, which help us to navigate between them. Single View Application template has created two Swift classes – an AppDelegate class and a ViewController class along with Main story board file. It also has creates one image assets folder.
Right Pan or Tool or Help Window: This window is used to give us quick help.
Secondly, this window is used with some Xcode tools like Story Board and Interface Builder. We will see this window more in detail when we learn these tools. The right window as show, has two tabs. The first tab gives us file information, which is active on Xcode. The second tab, which when highlighted, gives us Quick Help of the text selected in the Editor.
The Right window is divided into 2 windows upper window and bottom window. Upper window we have already discussed. The bottom window has 4 tabs which are used with the tools. They have the Object Library and the Code library where you can just drag and drop things to the editor.
This section is mostly used with the storyboard and interface builder tools. Bottom Window or Console Window or Debugger Window: This window is divided into two halves. On the left is the debugger window with all debugging options like step up, step down and so on. On the Right window is the consolewindow where the console logs are printed.
Center Window or Editor Window: This window is the editor window where you will be writing the code for the selected project. When the project is created, the editor window appears showing the default settings
Suppose you select the AppDelegate.swift file from the Navigation Window than editor window will show AppDelegate.h.
In the next chapter, we will look at the typical life cycle of an iOS Application.