Swift Programming Language

Swift is a general-purpose, multi paradigm, object-oriented, functional, imperative and block structured language. Swift is the result of latest research on programming languages and is built using a modern approach to safety, software design patterns by Apple Inc. for iOS application, macOS application, watchOS application, tvOS application.
Swift is easy to learn, easy to implement, safe, fast and expressive. Developing Swift in the open has it’s own exciting aspects as it is now free to be ported across a wide range of platforms, devices, and use cases.

The features of Swift are designed to work together to create a powerful language. Additional features of Swift include:

Memory Management –
Swift uses Automatic Reference Counting (ARC) to manage memory. Earlier, Apple used to require manual memory management in Objective-C, but after introducing ARC in 2011 memory allocation and de-allocation became easier.

Swift is managed as a collection of projects, each with its own repositories. The current list of projects include:


Example:

// 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.

Advantages –

Disadvantages –

Article Tags :
Practice Tags :