The biggest announcement at Apple’s June 2014 concluded Worldwide Developers Conference was a treat for developers of the iOS platform and not for the end-users. It came in the form of a new programming language called Swift. While it didn’t mean much for the iOS touting crowd out there, but it certainly has had a big impact on the developers who develop for this popular platform. Till June last year Apple has primarily used Objective-C as a language, which had starting to show its age, as it was over 30 years old. With that age comes considerable baggage for developers. Swift was launched with the hopes of making the life of developers easier.
A new programming language may be a hurdle to ask all of its developers to learn, it’s a small obstacle that Apple can easily clear so long as it keeps developers focused on the end goal: millions of iOS users that pay up for content. With Swift in the market the main difference is that now it supports generics. Apple has taken a huge step in developing a new language. With generics Apple embeds more security for apps. Swift runs along with Objective-C. As a developer, there is no need to replace the whole code with swift. In the future it may be possible that apple replaces objective C completely with Swift.
How is Swift modern?
Until now it was mandatory for a developer to explicitly mention data type for a variable when developing for iOS with Objective C. With type inference, it is not mandatory to write data type for each variable any more. Swift explicitly catches data type of the variable using initial value that developer has assigned.
Swift introduces “Playground”, which allows Mobile app developers to see their result at run time. This Playground comes with 3 screens: Editor, Observer, Assistant Editor. With this new feature, developers can write the code separately and test it out without modifying other existing code. This playground code can be executed and testing independently, hence boosting development speed considerably.
One of the main features of Swift language is its a type safe language. It prevents passing different data type value to different data type variable. It catches exception at compile time itself if it finds any conflict in data type. Thus reducing run time overhead ensuring of this application runs faster. It also reduces run time application crashing.
With Swift programming language developers can use Unicode character for variables and constants naming convention. Earlier with Objective C, variables and constants name that were used had their own naming conversions – like variable should not contain special characters or it should not start with integer value. With the advent of Unicode developers can use names from any desirable language as Unicode character set consists of almost all the characters in each and every native language. This is a major boost to the non-English speaking developer community that would like to cash in on the booming success of iOS.
Benefits of Swift over Objective C
- Support for Generics
- Easy diagnostics/debugging
- Editor and Compiler run simultaneously
- Easier syntax rules (e.g. No need for a “;” after every line)
How is Swift ranked today
More than 6 months after its release, there is evidence from a number of sources that the interest in and use of Swift has continued to grow. And with it the use of Objective-C has started to regress.
Popularity of Programming Languages Index (PYPL) named Swift its Programming Language of the Year for 2014. The PYPL index is based on web searches for tutorials about programming languages.
Source : Popularity of Programming Languages Index (Dated: 25th Feb 2015)
In 2014, Swift saw the largest increase among all languages in its share of such searches, 2.9%. Swift is currently ranked #12 on PYPL with an overall share of 2.5%. Objective-C, on the other hand, while still ranked higher at #8 (the same spot it held one year ago) with a 6.1% share, is trending slightly downwards, with its share dropping by 0.2% in the past year.
Other similar studies by independent sources have claimed the same that although the usage of Objective C still is more than Swift, it is on a decline. On the contrary, the use of Swift is growing worldwide with educational interest seeing a boost as well.