Open In App

Introduction to Swift Programming

Swift is a general-purpose, multi-paradigm, object-oriented, functional, imperative and block structured language. It is the result of the latest research on programming languages and is built using a modern approach to safety, software design patterns by Apple Inc.. It is the brand new programming language for iOS application, macOS application, watchOS application, tvOS application. Soon it became one of top 5 programming language and gained popularity among Apple developer community over the few years of time replacing the old school Objective C.

Evolution of Swift Programming Language:
Swift language was developed by ‘Chris Lattner‘ with an aim to resolve difficulties existed in Objective C. It was introduced at Apple’s 2014 Worldwide Developers Conference (WWDC) with version Swift 1.0. Soon, It underwent an upgrade to version 1.2 during 2014. Swift 2.0 was introduced at WWDC 2015. Initially, version 2.2 was made open-source software under the Apache License 2.0 on December 3, 2015, for Apple and Linux platforms. It is primarily designed to work with Apple’s Cocoa and Cocoa Touch frameworks and the large body of existing Objective-C code written for Apple products. Swift language has gone through major changes since its release from version names 1.0, 2.0, 3.0 and 4.0 and later. The current released version is Swift 4.2 with a beta version of Swift 4.3 and Xcode 10.



Changes include the following areas:

Major and promising changes in the latest version i.e. Swift 4 and later includes the following:



Programming in Swift




// Basic Swift Program
import UIKit
  
var str1 = "Hello geeks!"
var str2 = "How are you?"
print (str1)
print (str2)

Output:

Hello geeks!
How are you?

Run: Code can be tested on Online IDE for Swift

Note: Import statement is used to import any objective-C framework or library directly into Swift program. var keyword is used for variable and let keyword is used for constant. There is no need of ; for termination, in case programmer uses it compiler won’t show error.

General Features of Swift programming language

Advantages:

Disadvantages:


Article Tags :