Affiliate Disclosure: By buying the products we recommend, you help keep the lights on at MakeUseOf. Read more.
Apple’s new programming language for iOS and OS X will fundamentally change how developers create the applications we love, and lowers the barrier to entry for people looking to get started with developing apps.
Swift, as it is known, was announced at the 2014 Worldwide Developer Conference and received a rapturous applause from the audience. From the get-go, developers knew this was going to be big. But why should you care?
There are three main groups that will benefit from Swift being around: developers, students and consumers.
“What would it be like if we had Objective-C without the baggage of C? We did more than think about it. We have a new programming language. It’s called Swift, and it totally rules”
One can only assume that when Craig Federighi announced Swift, he first mentioned the one thing that developers are sure to love.
For the longest time now, the given way to develop native iOS applications was with C, C++ or Objective-C – the language that was developed in-house by Apple in 1983. Objective-C inherited a lot of baggage from C and C++, although added Smalltalk-type messaging and a way to do object oriented programming that was slightly more approachable than C++.
However, where Objective-C falls down with respect to pure developer productivity, it more than makes up for it in sheer developer community. I’ll be blunt. Objective-C is an insanely fast language, with the code being compiled down to highly optimized bytecode.
Swift happens to be a nice happy-medium between the sheer speed of Objective-C and the development loveliness of a modern interpreted language. A lot of the bulk of Objective-C is removed. There’s no longer a need to define whether a variable is an integer or a character, and manually managing the computer’s memory with pointers is heavily discouraged.
Furthermore, Swift allows developers to accomplished tasks with a a variety of programming styles. These include functional programming, where everything is treated as a mathematical calculation; procedural, where tasks are accomplished sequentially and linearly; and object oriented, where data is represented as real-life objects.
You can start using Swift, since Swift produces highly optimized LLVM compatible bytecode (the instructions that are executed on the device) and accesses the same APIs that one would use with Objective-C and C. You can integrate Swift code with existing projects, libraries and applications. And if you find yourself needing to go down a level and manually manage your own memory, you can still fall back to Objective-C.
As a developer, I know how fun it is to play with a new language, framework or API. Despite that, I feel that Swift is more than just a toy language. I feel it will fundamentally change how applications are developed.
In years to come, we may see the common ‘Hello World’ application replaced with a Swift app. Why do I think this? Because Swift is a beautiful, intuitive take on application development.
We’ve already talked about how Swift is syntactically lovely. We’ve also talked about how Swift retains the sheer ludicrous speed of Objective-C. These alone will make Swift a compelling choice for programming students. But we’ve not talked about Playgrounds.
First we need to talk about what a REPL is. This acronym stands for Read, Eval, Print, Loop, and refers to the ability to write code and interpret it line by line. This is handy when you’re testing an individual section of your code or an idea without having to run an entire project.
Playgrounds are a feature in Xcode 6 that allow you to interpretively run through an application, and see how it would work, step by step. This makes learning app development significantly easier, as applications become easier to debug, and the development process comes with real-time feedback on how a section of logic works.
Swift precipitously drops the barrier of entry for learning to develop applications, and for this Apple is to be commended.
This one is tricky. Most application users aren’t developers, and don’t care about programming languages. Provided the applications do what they are told, reliably, most consumers are happy.
The introduction of Swift will have major repercussions for the Apple application ecosystem. As app development becomes easier and easier, developers for other languages will be tempted to start building applications for the iPhone and iPad. But what does this mean?
Firstly, more developers are going to be attracted to the platform. More developers means more applications, and more variety in the applications available. What this means for the quality of the applications, however, remains to be seen. Swift is a very new technology, and it is one that isn’t fully understood by developers. Furthermore, it’s one that is fundamentally more accessible to novice and beginner developers. Whether this is a double-edged sword remains to be seen.
If you’re not sure why Swift is nothing short of revolutionary, have a look at the source code on Github. Look at how much it resembles a modern interpreted language. Look at how few lines of code there are and how clean and easy to read everything is.
Want to get started with Swift? Unfortunately, you’re going to need a copy of the Xcode 6 beta. This requires an Apple developer account, costing $99. Failing that, you can wait until fall 2014 when the latest version of Xcode is released to the general public.