You are here Home » Tech » Everything You Need To Know About Apple’s New Programming Language ‘Swift’

Everything You Need To Know About Apple’s New Programming Language ‘Swift’

by Fahad Saleem

Everything You Need To Know About Apple’s New Programming Language ‘Swift’

This year at WWDC, Apple has taken the biggest step of the decade and announced a new programming language named Swift. During the whole event much too much attention was given to iOS 8 and OS X Yosemite that the news of this programming language went into the background. From a customer’s point of view it is of no importance which programming language was used to develop the product he is about to buy but for developers this would certainly ring the bells of news opportunities.

Apple was far behind in the stream of programming languages because rather mature Microsoft already had its own language named .Net Framework and then even Google had its own Go (Golang). By announcing its own programming language, Apple has now joined the league. Apple has claimed that Swift has been rightfully named Swift and it inherits all the merits of its predecessor programming languages, at the same time making it many folds fast.

Why a Programming Language

A piece of hardware is nothing but a mere assembly of tools at your disposal. They don’t understand anything if you don’t make them understand it. Electronic hardware is literally the dumbest thing known to humanity on its own. To get things done from electronic hardware, we need programming languages. Hardware cannot “think” or “understand” like we do so we need to explain the meaning of “stand up” too to it if we want to make it stand up. The way we do that is defined by the type of programming language we are using.

In the very beginning there was machine language which was nothing but telling every transistor in your device when to turn on and off. This evolved into low level and high level programming languages. Low level programming languages are more close to machine language (Like Assembly). High level programming languages are more purpose oriented. The purpose of evolution of these languages is to make them close to our own languages at the same time making them fast and more robust.

Why Apple’s Swift

Every programming language has its own merits and costs. Some are close to machine language but extremely faster than other languages, others are easy to code but not very robust when it comes to communicating with hardware. Some are easy to debug but have a limit to things you can do with them, others have limitless possibilities but very hard to debug.

Apple has previously relied on Objective C for development of its products and apps and on C language even before that. Objective C seems to have worked good for Apple considering that it has been their development platform for nearly 30 years now so what made Apple spend 4 years in research, developing another programming language? The answer is they have made every effort possible to make hardware as fast as possible and there doesn’t seem to be much room for transistors getting any smaller now because after all you can’t make them smaller than their crystal size and technology has already brought things to nano level. So to make things faster they have focused on making the communication to hardware faster now and that’s what Swift will do.

Comparing Swift to Others

The official ebook on this new programming language is available free on iTunes to download and it claims that “Swift adopts safe programming patterns and adds modern features to make programming easier, more flexible, and more fun.” Comparing it to C programming language and to Objective C, it does not suffer compatibility issues. It is more close to “scripting” languages than traditional programming. It inherits merits of Python which is probably the fastest language known, and is capable of doing things that Python isn’t. Unlike C or Objective C you do not have to write the complete (or at least one meaningful chunk of) code, compile it and check for errors. Instead there is a visual Play Ground where you can see what each line of your code does as you write it.

swift 2

Other than simplifying debugging and making it easier for developers to code, it inherits the merits of Rust, C#, Ruby, Python, Haskell, CLU and others. It goes one more step forward and minimizes the number of code you have to write to make something work. It eliminates the need of including libraries and all, along with the much dreaded universal cause of syntax errors “ ; “. For example printing a simple “Hello World” becomes actually simple when all you have to write is

swift 3

Instead of

swift 4

It does put a lot of people out of jobs though because there are thousands learning and teaching development of apps for Apple. Another drawback, the market will be flooded with immature apps initially as there are few mature programmers for Swift available.

You may also like