Image Credit: https://developer.apple.com/swift/
Apple confidently describes Swift as “the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language.” The company promises Swift to be a fast and easy way of programming apps for the iOS and OS X.
By merging the best features of C and Objective-C, and surpassing their limitations, developers can code apps faster. Swift’s syntax, for one, is shorter than Objective-C. This also makes Swift easier to learn, especially by new programmers. The lower barrier to entry is expected to bring in new and experienced mobile programmers to the Apple fold (and away from Android), as well as to increase the number of apps in the iOS and OS X marketplaces.
To help existing Objective-C developers with the transition, Apple also designed Swift with interoperability in mind. Developers can use Swift alongside existing frameworks and incorporate it with their current applications without much effort.
Swift does not simply inherit the procedural and object-oriented features of its predecessors. It also packs some powerful features:
● Write code more expressively. Use generics and multiple programming patterns. With a clean syntax, it is easier than ever to read and maintain APIs. With namespaces, logically related objects are bundled together, to allow modules to co-exist without collisions. Swift is also intuitive enough to infer from context which makes for cleaner code and less mistakes. And say goodbye to semicolons because there’s no need to type them anymore.
● Code in a safe environment. - Swift is what’s called a type safe language. This means that it prompts its user to be clear when writing code. It automatically checks your code and flags errors, to efficiently correct them during the development process.
● Preview work with interactive playgrounds. Swift introduces Playgrounds, a feature that lets you type lines of code and see the results on the same interface instantly. Does your code run over time? The timeline assistant lets you review your progress as you go.
● Code fast and efficiently. Swift is a relatively small language in terms of its standard library. It makes use of syntax and grammar in a straightforward way, enabling a concise code. The debugging console applies an agile methodology for shorter development cycles called Read-Eval-Print-Loop (REPL).
Since Swift can co-exist alongside existing files in the same project, it is also easy to adopt. Though developers can’t upload an app built on Swift to the Store yet, they can now begin implementing new features or enhance existing ones.
Eager developers have started to try out the new language as soon as it was made ready for use. Based on a repository search on GitHub, there were already over a hundred results for Swift only days after its launch.
However, not everything is rosy. Swift, being exclusive to Apple, means it will be more tedious to recreate apps on other platforms than before. And contrary to its design as an easy-to-learn language, it may actually take some getting used to, as new developers might get locked in. Swift's error prevention and memory management functionality can save time but exempt newer developers from learning crucial programming methods.
Also, Swift may not be as swift as it promises. According to some speed benchmarking tests cited by InfoWorld.com, “Swift ran 10 to 20 percent slower than the original test numbers in some cases and 10 to 20 percent faster in other cases. But Swift was still slower than Objective-C.” Of course, these tests are hardly definitive, and it’s still too early to judge Swift’s overall performance.
There is no doubt that Apple’s new programming language, Swift, is very promising. If it can follow through on all its promises, it may very well change the landscape of how desktop and mobile applications are created in the next few years.