app development

Introducing Swift – Apple’s New Programming Language

Introducing Swift – Apple’s New Programming Language 150 150 Kerry Butters

At a recent developers conference, Apple revealed its new iOS 8. This was met with mostly favourable responses and the current beta test is being used by a number of developers. The new iOS will be generally released sometime in Autumn this year.

That’s not all of the news to come from the Cupertino based company, and it seems that Apple is addressing its programming language. The Worldwide developers conference saw the introduction of Swift, which is widely regarded as an attempt to keep developers onside. Google’s Android OS is gaining market share and so Apple needs its own innovative approach to combat its rival’s success.

Apple is targeting a younger age range of developers than it has in the past and Nolan Brown of Vindico said: “It shows extreme promise for younger demographics, 13-, 14-, 15-year-olds.”

This is a new approach but one that may also present problems. According to Brown, “You’re going to end up seeing more applications, but also more applications by less experienced developers, which may result in more bugs, (and) less-refined user experiences.”

However, reports suggest that it’s not just for the younger, or less experienced developer. It seems that the new language is already capturing the imagination for many and so for Apple, the future for Swift looks bright.

Let’s have a look at what it can do.

Faster Apps

Objective-C has been the standard for Apple programmes for well over a decade. Swift promises a change to that standard and Apple has stated that it will be 75% faster than its current aging programming technology. This will allow developers better (and more current) tools to develop more complex and graphically rich apps.

Easier for developers

We’ve already mentioned that Swift will be better suited for younger developers wishing to explore programming than its Objective-C counterpart. The other thing is that Objective-C is complex and notoriously difficult to write code for. Swift on the other hand is a much simpler syntax, and this will ensure that it’s much easier to learn for beginners. This doesn’t mean that anyone can use it and Swift doesn’t open the door to those with no programming experience. It will however make it significantly simpler for aspiring developers to experiment and devise apps on this platform.

The more simplistic approach promised by Swift doesn’t just make it easier for novice programmers but experts too. Swift’s simplifications will benefit expert programmers, as it will make their jobs easier. Apple has cherry-picked features from a variety of sources making it more familiar to seasoned developers, potentially widening the potential talent pool that can utilise this new technology.

Fewer bugs and coding errors

As a software Swift is designed to make everything that little bit easier. The programming tool will catch coding errors ensuring that they don’t make it into the final product. Ideally this will create a scenario where developer productivity is increased, and applications are designed with a much more stable basis.

‘Playgrounds’ – Interactive code edit

Swift comes with a function dubbed ‘Playgrounds.’ This is an interactive sandbox that allows developers to tweak and play around with graphical previews of how the code will work. This negates the need to compile an entire application first, once more ensuring much more productive developers and less time consuming re-edits.

Why now?

So, Swift seems set to change the programming landscape and provide a far more democratised world for burgeoning programmers to emerge and experiment within. Apple migrated development to LLVM providing the tech giant with much more control of its own runtime and toolchain.

This has made implementing changes and understanding their consequences a much simpler process. Apple has gained some experience with language development and in the past added Automatic Reference Counting, and closures to Objective-C. These changes provided Apple with an understanding of how developers might respond to future changes and additions to its programming platform.

Effectively it was all those small changes along the way that created the right environment for Swift to be introduced within. Closures, Automatic Reference Counting, and variables are all handled in a similar manner to Objective-C. Perhaps the best part is that because Apple is in control of everything, the same runtime can support both Swift and Objective-C. This allows legacy code to be mixed in with the new language and the change is hardly disruptive at all.

Basically Swift provides developers with a trade-off. In Objective-C coding was much more readable and easy to understand, but it was also more time consuming to write. Swift looks a lot like a hybrid approach but really it does provide one noticeable difference – Swift is quite a bit harder to read.  In Swift users will have to be very specific with their coding and most developers will have to develop a careful understanding of how the new language will work.

Not revolutionary, but a necessary upgrade

Swift isn’t a radical move away from Apple’s Objective-C but it is a much more modern and innovative approach. It looks like it has taken Apple around five years to play around with the software and juggle developer expectations with the reality of implementing a new programming language.

Most of Swift’s new features already exist in other programming languages and so for many developers it will seem very familiar. Apple has added mostly very good features to its programming code and the things that have been taken away were generally under utilised anyway. Effectively Swift opens up Apple’s coding practices to a new, and often younger, development pool; let’s hope that it provides some innovative new applications and tools for Apple users.