Swift Development Environment Setup

Generally, in swift we use playground interface to do programming for that we need to install XCode Editor which is the built-in free editor of Apple and it’s used for any type of development for apple platforms like OSX Software’s, iPhones App and etc.


Once we are familiar with swift concepts then we can use Xcode IDE to develop applications for any type of apple platform like OSX Software’s, iPhones App, Mac, etc.

Swift Setup Requirements

The basic requirement to install Xcode editor, we should have minimum Apple Laptop or Mac Computer for the development of iOS applications using swift. We can download Xcode editor from the Apple website or Apple app store and this editor is completely free we don’t need to pay anything for Apple.

Download Xcode from Apple Store

In case if you want to download Xcode from the Apple app store open the app store in the system and search for Xcode in the search bar and download it. Following is the screenshot which shows how to search Xcode and download from the app store.


Download xcode from apple app store

Download Xcode from Apple Website

In case if you want to download the Xcode from a website, we need to sign up for the Apple Developer Program which is free and download the Xcode editor but remember when we are going to publish our application Apple will charge 99$.


Once we sign up on the Apple website with Apple account and go to the Downloads section and download the Xcode Editor. Use this Download Xcode Editor URL to login and download the Xcode editor.


If you open and login to the apple website by using the above URL go to the downloads section, you will find Xcode editor to download like as shown below


Download ios xcode from apple developer website


After download click on Xcode.dmg file, just drag the Xcode and drop into the Application folder like as shown below and our Xcode installation will take 2 to 3 minutes.


Drag xcode and drop into application folder to install

Swift Hello World Application

Now we will see how to write a simple "Hello World" program in swift with example. for that Go to Search which is in the top right side at menu bar --> Click on it and search for “Xcode” and open it like as shown below.


Search for Xcode Editor in Apple Mac Laptop


Once we open Xcode the welcome window will open like as shown below. In the welcome window click on the first option “Get started with a playground” to create a project in swift.


Xcode application to create ios project


After selecting “Get started with a playground” a new window will open in that we need to give the project name as “Hello World” and select platform as “iOS” and click on Next like as shown below.


Give Swift project name and select iOS platform


Once we click on the Next button new dialog will open in that we need to select the location to save our project. Once you select the location to save the project then click on Create button like as shown below


Select Location to Save Swift Project


Once we click on Create button new project will create and the playground window will open like as shown below.


Swift Playground Interface to with Swift Hello World Example


Generally, swift playground window will contain both input and output windows side by side like as shown above. 


Following is the simple “Helloworld” code written in the swift playground (Left Hand Side).


import UIKit

print("Hello World") 

The above program will display the result like as shown below (Right Hand Side).


Hello World

This is how we can use the swift playground to write and execute programs based on our requirements.