Here, this article gives the information about some of the components of Xcode, which are important in the development of iOS app.

Here in the object library, in the lower right corner of the Xcode, you can see all the available components of Xcode. These components are provided by Apple Inc and are required for the development of iOS app.

Like in the below image.

object-library

 

Move on to a next step of creating a new project and give the name of your wish.
Search for the elements like button, label, or textfield etc.
Here, we have worked upon textfield button.

 

textfield-selction

 

Drag it to the position where you want to locate it.
While positioning the object make sure that it aligns with the blue dot line.

textfield-puting-on-the-position

You can change the size and arrangement of the object through the Size Inspector views which appears in the upper right corner.

size_inspector

Now, increase the width size of the textfield.

using-margin

Similarly, add the other elements.
Make the UI similar to this image.

uilabeluitextfield-uibutton

Add, one more elements .ie blank UITextLabel which we will use in future, to greet on the button tap action.
The whole View will be similar to this image.

adding-blank-uilabel-for-greetings

Now, let’s move to the coding part, for which we all are waiting.
First, create and add the outlets. You can find the option in the assistant editor of the xcode by clicking on the 2nd menu of upper right corner.
assistant-editor

Just click any UI elements from the storyboard. Hold the Control Button and drag it to the code window which opened after clicking on the assistant editor.
connecting-outlets

And, in the case of the UIButton just change the connection type to Action and sender Type to UIButton . Connect the outlets and add button action .

userGreetingLabel.text = userTextField.text!

The viewController code will appear like this:


//
// ViewController.swift
// Hello_World
//
// Created by Admin on 22/11/2016.

// Copyright © 2016 Admin. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
print(“Hello World”)
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}

You can download the whole source code for the same from my GitHub repository.

Image credit: techprevue.com

Load More By qwertyasvishwa
Load More In code corner

Check Also

Buil Your First Camera App – Swift

Today,  I will share how to make a Camera App, and store the clicked Selfie and upload the…