What is Swift ?

By Richa Tiwari|Updated : July 23rd, 2019

Overview-

  • Swift, rightly named after the Swift bird (which is one of the fastest fliers) was developed to be a faster alternative to Objective-C.
  • It’s a safe, fast, and interactive programming language that combines the best in modern language.
  • It is a scripting language used by industries.
  • It is an alternative to the Objective-C language which was the recommended and most popular language for building apps for Apple’s ecosystem of devices.

History of Swift-

Year

Version

09-09-2019

Swift 1.0 

22-10-2014

Swift 1.1 

08-04-2015

Swift 1.2 

21-09-2015

Swift 2.0 

13-09-2016

Swift 3.0 

19-09-2017

Swift 4.0

29-03-2018

Swift 4.1 

17-09-2018

Swift 4.2

25-03-2019

Swift 5.0 

Comparisons between Objective C and Swift-

  • As compared to Objective C, syntax of Swift is easy.
  • In Objective-C, you have to maintain two code files for each class you write — a header file with a .h extension and an implementation file with a .m extension, while in swift only one is maintained.
  • As of now, there is a compiler for swift for Linux. This is a huge step-up from Objective-C which could only be used on a Mac OS machine.
  • Statements do not need to end with semicolons (;), though these must be used to allow more than one statement on a line.
  • Generic Programming.
  • Functions are first class objects.
  • Enumeration cases can have associated data
  • Swift 2.0 introduces a different and incompatible error-handling model.

Features of Swift-

  • Memory management is automated.
  • Integers are checked for overflow.
  • Variables are always initialized before use.
  • Optional ensure that nil values are handled explicitly.
  • Error handling allows controlled recovery from unexpected failures.

Thanks
Team BYJU'S Exam Prep!

Comments

write a comment

Follow us for latest updates