Adjective: Happening quickly or promptly
Noun: A swift-flying insectivorous bird with long slender wings and a superficial resemblance to a swallow, spending most of its life on the wing.
On 2nd June, at the WWDC14, among the plethora of enhancements to the software from Apple, they also announced a new programming language. It’s called Swift. The icon follows the noun definition, while the working is supposed to follow the adjective – with an easy and fast development environment for developers to work in.
Over the last few years, since the launch of the iOS and the ability for developers to make apps for the iPhone and the iPad the language supported by Apple was Objective-C. It is kind of archaic with elements of C as well as OOP but not exactly falling into the C++ domain. Its not exactly an easy language for developing in and yet Apple would want more and more people to be developing apps, I think it is a good idea to have this conversion.
This is a surprising development in multiple fronts:
- They came out with an entirely new language. Its not often that a new languages are made.
- No one expected Apple to come out with it. This is somethig you would expect from Google but Apple ? Nah!
- It is faster than Objective C ( swift as an adjective ), and much much faster than python on same system ( and Python is one of the easiest languages to use).
- It is a language tailored for Apple’s environment. So, you can say good bye to using it for other OSs unless someone starts making an emulator (not sure if Apple’s legal will approve).
Why would you be excited you ask ? Its quite simple, the simplicity of the language makes it easier for people to jump into development. Small things that always create issues – like improper initializations, memory management, etc are handled automatically. I expect more kids to get into programming with this and programming to become ‘cool’. There has been a lot of effort to project Python as a user friendly language (and it is), and Apple is in all probability trying to leverage the same mindset here (and hence trying to compare it with Python in the WWDC and not any other language)
Swift seems to have been in development for quite a while now, so Apple has made their coding environment – Xcode – also compliant in a novel way. Usually when you write a program you have to issue a Run command to see its output. Xcode & Swift do away with that as whatever you are writing is immediately shown on the side of the XCode application in what Apple calls ‘Playground’ ( notice the emphasis on Play).
As an initial example, the universal first program of printing hello world will be :
That’s it. There is no need to import libraries, or run it. Xcode will have the correct libraries imported, and print the output in the Playground.
It is not easy to come up with a new language, and it takes years for it to become mainstream. However, Apple has just the ‘One More Thing’ trick without saying it. It’s a fully baked language, and with the momentum of Apple behind it – its going to become the de facto language for developers.
If you have an iOS device or a mac, you can download the book from iTunes here.
About the Author: Vibhu Rishi has been a techie and product manager for over 15 years. He’s a gadget freak and avid gamer, and follows tech across the globe with keen interest.