Introduction to Swift

Apple presented a new language for iOS and OSX developers called Swift. Its now came to light that Swift was underway since 2010, which is 2 years after the first SDK was released. Apple saw the restrictions of Objective-C which is very nearly 30 years old and decided it was the ideal time for a change. In any case, in genuine Apple style, they would not like to release a partially completed language. They understood that regardless of the downsides of Objective-C, they could even now push the envelope with it, thus they did.

At the point when discussing Swift, Apple alludes to three key considerations: Safe, Modern and Powerful. It satisfies every one of those three things. Outlined below are some of the very basics you need to get up and running with Swift.

Using Swift:

To Start up with Swift you will need to do the following.

  1. Download and install Xcode6. (you will have to sign in before you download)
  2. To install Drag the Xcode6 into the Application Folder.
  3. The Xcode will be there in the Application folder and you can launch it form there once installation is completed.

Understanding Xcode Screen:

The welcome screen will have the following 3 options.

  1. Get started with a PlayGround.
  2. Create a new Xcode Project.
  3. Check out an Existing Project.

xcode6

We will use the PlayGround to learn Swift Programming. So we will select the first option form the welcome screen to Make a new PlayGround file.

Getting started with PlayGround:

The first screen will prompt you to enter the name and select the Platform. Once you put in the necessary details the PlayGround will open up. The PlayGround has two column screen.

  1. The first column is the Code Editor
  2. The second one is the Results pane.

PlayGround

 

to open the timeline you need to span over the “Hello ,playground”. Here you will see a symbol with concentric circles. Click on it. this will open up the Timeline Panel.

PlayGround

 

By default the PlayGround has a string which says “Hello, playground”. We will understand whats a string soon in coming topics. For now we just look at it as a plain statement in English. To check if the playground is correctly installed we will begun with the classical “Hello, world!” Example. this will confirm the installation of Xcode is perfect.

Hello world in PlayGround