Apple Swift: Should CIOs Bite?

Swift, Apple's new programming language, has developers buzzing. Should IT execs turn their dev teams loose?

Erik LaMana, Senior Software Engineer, WillowTree Apps

June 27, 2014

6 Min Read

IT teams are scrambling to figure out just what Swift means for their mobile app strategies, from both a development perspective and for potential business advantages. As you might expect, there's skepticism from experts reluctant to add yet another tool to the mix. And, there's some resentment at still being tied to Apple's proprietary platform.

But for the most part, mobile developers are doing the Snoopy dance as they start to delve into the nuts and bolts of the Swift language.

What's all the excitement about? With Swift, Apple promises that mobile apps developed by iOS and OS X programmers will run faster and more smoothly than apps developed with Objective-C, the 20-year-old programming language currently used by most Apple platform developers. A more modern option, Swift takes features from languages like JavaScript and offers the "power of Objective-C without the C" to create a new level of interactivity on the iOS platform. This makes Swift a robust development tool for social networking apps and 3D games.

Some challenge Apple's claim that Swift represents a faster programming tool, especially since it's considered a "friendly" language. Yet there is much more that goes into the speed of a language beyond the syntax; for example, the effectiveness of the compiler and the type of runtime have significant impact on speed. With Swift, Apple is in full control of the language and has included new features that allow for more efficient optimizations within the LLVM compiler. These make the binary code run faster and more efficiently. For example, Swift developers can specify that all objects are of the same type, so when developers iterate through them, they don't have to make additional calls to check class type before making calls, as they must do using Objective-C.

[No one disputes the convenience of public cloud services. But when you look ahead a few years, the cost picture for enterprises is murky, even in light of the price war among Google, Amazon, and Rackspace. What's your take on the ROI reality? Tell us and enter to win a Fire HDX.]

Swift also includes elements of functional and Object-Oriented programming. For instance, Swift adds additional layers of abstraction that support code reuse on a level not previously possible. Developers who view the complexity of C and Objective-C as a barrier to entry might have an easier time. Javascript, Python, and Ruby developers will see something of their own languages in Swift. By leveraging Xcode's powerful code completion and accessible documentation, developers coming from these languages should be up and running on Swift in no time.

Moreover, since Swift is tailored for Apple's APIs, Cocoa, and Cocoa Touch, iOS developers can more easily use compact expressions when writing code for app construction. Whether writing for games or traditional apps, there is often a lot of repetitive code in the form of loop configuration or bulk modification. Swift brings sensible functional elements into play, reducing the amount of time and overhead for these operations.

In short, I see Swift as good news for businesses looking to deliver strategic mobile apps in a timely and cost-efficient fashion.

As part of the Swift announcement, Apple did include a few sticks to go with the speed carrots. For example, it introduced Playgrounds, which provide a REPL (read-eval-print loop) environment with significant developer and debugging feedback that won't be available to Objective-C developers. Although Swift code can run alongside Objective-C and C in the same application, the Playground feature provides a preview of what's being programmed by constantly looking at code and evaluating it, without the need for compilation. During Swift's introduction at WWDC, Apple CEO Tim Cook demoed how a developer could visualize a flight path of an in-game blimp (in real-time, no less) just by tweaking a few lines of code.

So are Objective-C's days numbered? Not necessarily. Some mobile development problems are still best solved by Objective-C or C; for example, manipulating raw data, like with a binary format. On top of that, there are 275,000 registered iOS developers in the United States alone, most of whom are familiar with Objective-C. Some may switch to Swift, but the majority will continue to build using the language they know and trust.

And, developers using Swift still need to know Objective-C well to write apps, since there is a huge collection of APIs and libraries that are written in Objective-C (including Apple's Cocoa and UI Kit).

The opportunities (and fear factor) Swift presents remind me of when Microsoft introduced C#, a multiparadigm programming language built on the syntax and semantics of C++ to allow C programmers to take advantage of .NET and the common language runtime. At the time, Microsoft pushed hard for the language's acceptance and, whether by design or circumstance, the attention it gave C# adversely affected developers using its former top language, C++ (no, not Visual Basic). It was not a pleasant experience to be a Microsoft C++ developer around that time. As new C# tools like Visual Studio rolled out to the booming software development world, the C++ crew was left to languish.

The danger with Swift is that this scenario could happen again, with Objective-C developers doing the languishing.

We won't know the full implications of Swift until developers have a chance to use the new language and suss out the true productivity gains. But CIOs should encourage dev teams to take a look. Apple added features, such as closures, templates, generics, and default parameters, that Objective-C developers have long pined for. These features enhance the expressiveness of the language and allow developers to write code in a more concise and understandable way. We may not see any improvements considered earth shattering, but in time, I expect positive outcomes as the development community figures out new and elegant ways to solve problems using Swift.

From a business perspective, Swift may be a new language, but it already has vast support and libraries. There's little risk of the issue that sometimes hounds newly introduced languages, as developers stare at the screen asking, "What do I do with it?"

A bigger risk for businesses is not having skilled development teams to tap into these programming languages. We live in a rapidly changing mobile world. Swift can help you keep up.

Managing the interdependency between software and infrastructure is a thorny challenge. Enter DevOps, a methodology aimed at increasing collaboration and communication between these groups while minimizing code flaws. Should security teams worry -- or rejoice? Get the DevOps' Impact On Application Security report today (registration required).

About the Author(s)

Erik LaMana

Senior Software Engineer, WillowTree Apps

Erik is a Senior Software Engineer at WillowTree Apps, where he is responsible for developing custom iOS applications for clients. He has extensive multi-language development experience (Objective-C, C/C++, C#, Java/J2EE, Python, HTML, PHP) and is credited for his ability working with embedded and networked systems. Erik brings extensive experience working on projects with a heavy emphasis on mobile security and privacy.

Never Miss a Beat: Get a snapshot of the issues affecting the IT industry straight to your inbox.

You May Also Like

More Insights