iOS Development - User interactive Hello World

Here, I am going show you how to create a basic user interactive Hello World app for iOS devices, using Swift language and Xcode IDE.

Step 1

Open Xcode and create a new single view project. Wait for some time to load the projects.

Step 2

Click Main.storyboard in the left tab. An iOS device demo will appear. Drag and drop a Text Field, Label and a button, as shown below at bottom right.



Step 3

Click ViewController.swift in the left tab.Now, we have to code. This will be the default code. We have to add some codes in UIViewController{<here>}.

First of all, we have to add our label, button and text field to the program. For this, hold control and click on the label, drag and drop it to our program. Select outlet in connection mode and name it labelOutput and do the same for text field (Name it textName). For button, we have to change the connection type to button and name it btnAction. 

Inside the btnAction function, copy the code given below.  
  1. labelOutput.text = "Hello " + (textName.text)!   
Finally it will look like 
 
 

Now, run the app by clicking the play button at the top.

Now, our app is ready.
Ebook Download
View all
Learn
View all