This tutorial will help you to write your First iOS Hello World application using Swift language. I have explained this tutorial with screenshots.
Step 1 : Create New Xcode Project
First open your Xcode application. It will pop up with the below screen, now select "Create a new Xcode project"
Step 2 : Choose Application template
Now the second screen appears as shown below. This has different project templates for different apple devices like iphone, Apple watch, Apple TV etc., In terms of iOS there are different application templates like - Single View Application, Game Application, Master - Details Application, Page based application, Tabbed application, Sticker-Pack Application, iMessage application. you can choose the one you wish. For tutorial purpose lets choose "Single View Application " and click Next.
Step 3 : Configure Options for Project
This will open up Options window for your new project as shown below: with different options to configure your project
Product Name : Product Name is the name of the app that will appear to the customer
Organization Name : The organization name is an attribute of the Xcode project and is used in boilerplate text throughout your project folder
Organization Identifier : This should be in reverse DNS format. Ex: com.learning Product Name and Organization name are concatenated to create the default bundle ID.
Language : This can be Objective-C or Swift. In the recent past days Apple prefers to develop apps using Swift
Devices : You can choose iphone or ipad here but is recommended to choose Universal unless you have some app very specific to your device.
After selecting all these options, click Next
Step 4 : Final Screen
Next screen will ask you for a repository to save files, select your own then the final screen with look something like the below.
You can see 4 sections in the Xcode Workspace namely your Toolbar, Navigator Area on your left, Utility Area on your right and Editor Area in the middle. I will explain you more on this in the later tutorial.
Now are done with the basic setup for iOS Hello World Application using Swift.
Now lets see how to add text to your application which is very simple actually.
Click on Main.Storyboard on the Navigator Area towards your left as shown below
This will open up Storyboard for editing. Make sure you have selected
- "Show Utilities" at the right top of Toolbar
- "Show the Object Utility" in the Utility Area on the right side
Drag and Drop Label into the storyboard and type the text you wish
Now run your Application from toolbar hitting "Build and run" button. Select device that you wanted to be your emulator .
Hope this tutorial to create iOS Hello World app using Swift language will give you a good start for you future applications..
Hope you got to know the below listed information or answers to these question.
- Set up configuration options for project
- Understanding Xcode workspace
- Write simple text using Label
- Selecting different devices in emulator
- Executing application