position: fixed; top: auto !important; margin-left: 112px;

Get Started

Once you downloaded the Xcode, you are now set to create your first iOS App in Swift.

If you had not yet seen our step by step Swift tutorials series, we strongly recommend to get the basics of Swift first.

Open Xcode

  1. Goto File

  2. New

  3. Project

  4. Single View Application

  5. Enter your Project Name. Ours will be ToDoListApp

  6. Next


You might notice that ViewController.swift file has been created.


We will learn more about UiView Lifecycle but for now just know that you have to write the code in viewDidLoad method .

import UIKit

class ViewController: UIViewController {
    override func viewDidLoad()
    {
        super.viewDidLoad()
        print("Hello World")
    }
}

Output

Hello World

Main.Storyboard

Storyboard is the place where we design our app UI. Learning Storyboard is not as hard. It's just dragging and drop feature for designing User Interface(UI). So, let's first create one Label with some text and one Button which when clicked display an alert showing some message.


As shown in the figure, there is an empty scene where we add UI elements from Object Library and whenever we add any UI element it will also be included in Document Outline. The arrow on the left of the scene is the Initial View Controller by default.

If not yet seen our step by step Swift tutorials series, we strongly recommend to get the basics of Swift first.

Drag a Label and Button from Object Library in the empty scene.



Now, to change the text of Label select Attributes Inspector from top right menu as shown in figure.



Similarly, for button select button from the scene and move to Attributes Inspector.


Solve the Quiz of Article

1) What do you think viewDidLoad is the method where you gonna write your Swift App inital code?
Yes
No

2) Can we create the design of our To-Do List App using Storybord or XIB?
Yes
No


Previous Next Article







codzify.com


Largest collection of up-to-date tutorials to learn programming languages. We are focused on easy learning. Massive collection of interview questions one may need for preparation.

Social Profile


Linkedin
Twitter
Facebook

Copyright 2018. All rights reserved.