Create a First iPhone Application

iOS Tutorials: Hello World.

In this article, we will give you an understanding of how to create a simple iPhone Application. At the end of this article, you will have your First iPhone Application created and the architecture understanding of the iPhone Application.

We hope you have configured, the Development environments properly, if you haven’t done so please have a look at one of our articles here.

Getting started with First iPhone Application

  • Open Xcode
    • Hit “Command + Space” together, Spotlight Search appears, write Xcode and click on enter.
    • Click on “Create a new Xcode Project“.

 

iOS Tutorials: Open Xcode, Create a new Xcode Application.
Open Xcode, Create a new Xcode Application.
  • A window will appear asking to choose a template for the kind of application you are trying to create.
    • Select “Single View App“.
    • Click “Next” to Proceed Further.

 

iOS Tutorials: Create a Single View Application
Create a Single View Application.
  • Another Window will appear asking for the name of the project and initial configurations, we have named the project as “FirstApplication”.
  • Select the desired language in which you want to code, it can be Objective C or Swift.

 

iOS Tutorials: First Application Configuration.
First Application Configuration like Name, Language, Organisation, Identifier.
  • A Finder window will appear asking for the destination location, where the project needs to be saved.
  • As soon as the project is saved, this will be the status of the project as of now.

 

iOS Tutorials: XCode Preview
XCode Preview
  • Run the project. (Command + R)

 

iOS Tutorials: First Application Result.
First Application Result, blank white screen
  • We will now add a simple label and see the effects on the UI.
  • Navigate to main.Storyboard file to make changes to the UI.

 

iOS Tutorials: Main.stoaryboard
Navigate to Main.storyboard File
  • Drag and drop a UILabel

 

iOS Tutorial: Hello World Label.
Drag and Drop UILabel.
  • Set Frame and X, Y position of the UILabel

 

iOS Tutorials: Set UILabel Frame
Set UILabel Frame
  • Set Text and desired fonts.

 

iOS Tutorials: Set UILabel Fonts and attributes.Set UILabel Fonts and attributes.
Set UILabel Fonts and attributes.
  • Run the Project. (Command + R)

 

iOS Tutorials: Hello World.
Project Output

Note: Now we are all set as you can see this in front of you, a Xcode project is started and now you can kick-off development. We have configured a basic iPhone Application.

Basic Understanding of Xcode.

iOS Tutorials: Xcode Understanding.
Xcode Understanding.

We will now have a brief details of all the area’s in the XCode.

Toolbar: Here you can see options like:

  • Run the build and stop the build
    • Run  (Play icon) – Shortcut (Command + R)
    • Stop (Stop box icon)
  • Select the Device in which you want to run the application (Drop down after play and stop build)
  • Status of the application like
    • Indexing of the build
    • Building process
    • Running state
    • errors.
  • Editors pane
  • Top right corner (open close Navigation area, Console area and Utility area)

Editor Area: This is the portion of the XCode where we see the current file open for editing and may XIB’s or Storyboards to be edited.

Navigation Area: Here the whole structure of the project is visible, we can access any file in the project from this space.

Console Area: All the debug logs, OS Activity can be viewed in the console.

Utility Area: Here the configuration of each and every file is handled, like Auto layouts, Attributes, Class Allocation to XIB’s etc.

  • Run the Project and see the output. (Command + R to run the project)

 

Author: Chandra.rao

iOS Developer. #Life of an developer.... Learn New technology, Code, Learn New Technology, Code, Death.