Create your first program in Swift 3

suggest change

Here I am presenting how to create first basic program in Swift 3 language. First you need to have any basic programming language knowledge or not having then be ready to learn it from beginning.

Requirements for developments:

  1. MAC OS - Version 10.11.6 or later for new Xcode 8.2
  2. Xcode - Version 8.2 Apple Document for Xcode introduction.

Xcode 8.2 has new Swift 3 language features with new iOS 10 compatible APi’s.

Create your first program

First go to Application and open your Xcode 8.2.

After that you will see the screen

Then choose Create new Project and after that you will see next screen

This is also very important part inside Xcode for selecting our project type. We need to choose our project according to types of OS. There are five types of options available on the top side:

  1. iOS
  2. watchOS
  3. macOS
  4. Cross-platform

Now we are choosing iOS platform for development and creating very basic project with the single view application option:

Then we need to give Product Name, this will represent your Bundle name and application name.

Application name you can change later as per your requirements. Then we need to click “Create” and after that your screen will look like this one below:

Inside this class you can see the file name is ViewController.swift and inside the class the name is also ViewController which is inheritance by the UIViewController super class and finally we’re creating our first variable which name is myString of the type ‘String’. Add the following under ‘super.viewDidLoad()’

let myString = "Hello, World!"

We are going to print the content of this variable. First, select your simulator type at the top left hand side of the screen and then click on the “Run” button.

After that your output will be shown on terminal which is on bottom right hand side. Congratulations, This is your first Hello World program inside Xcode.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents