Apple recently announced that the forthcoming Xcode 6 will include support for their new programming language, Swift. In the mobile development realm this announcement has naturally created quite a stir among iOS and OS X project stakeholders.

In this post we will take a brief look at what Swift is and what the implications are for businesses and developers.

What is Swift?

According to the Swift documentation, Swift is

"a new programming language for iOS and OS X apps that builds on the best of C and Objective-C, without the constraints of C compatibility."

For those familiar with Ruby, Python or Lisp, transitioning to writing software for Apple devices has suddenly become much more familiar. Many of the arcane parts of the Objective-C language that befuddled new developers are gone; replaced with modern features borrowed from popular languages.

Apple CEO Tim Cook said

"Swift is fast. It is modern. It is designed for safety and it enables a level of interactively and development you've never seen before on the platform… "

With a concept called "playground", Apple has made an interactive scratch pad feature to let developers test and tweak code snippets interactively. This will greatly reduce the amount of time consumed by the build-compile-run cycle. A developer can make some code changes and immediately test their impacts. Additionally, Swift allows a user to use Apple's Interface Builder tool with Swift to make design tweaks in real time.

These claims can be both exciting and worrisome, and while Apple has already provided many Swift language resources, there are broader questions to consider.

How long until Apple requires Swift?

Apple has apparently been working for years laying the foundation to support the new language. In fact, this new language shares many similarities to a language, Dylan that Apple helped create in the early '90s.

The first developer releases of the iOS 8 and Mac OS X Yosemite APIs are already moving towards Swift syntax. This gives us insight into Apple's trajectory. While there has been no official timeline announcement from Apple, I think it's fair to assume that Apple will eventually migrate their API's to Swift only and will deprecate Objective-C. It makes sense to begin thinking now about that eventuality.

Can Swift and Objective-C/C/C++ live happily together in the same project?

In short, yes, both Swift and Objective-C source files can exist in the same project (using a method called "Mix and Match"). Also, compiled Swift object code is already compatible with iOS 7 and Apple has promised compatibility with compiled code as the language evolves. While it is possible for Swift and Objective-C to share a project, there are implications to consider. For example, Objective-C cannot access many of the Swift language features like generics, tuples, structures, nested types, etc. Also, when adding an Objective-C source file to a Swift project a "bridging header" file must be added to your project.

All of this means that careful planning and due diligence is required when considering how to transition Objective-C and Swift projects. In other words, there's more involved than simply learning the Swift language.

Should we adopt Swift sooner or later?

Apple has made their intentions clear - Swift is the language for iOS and Cocoa development. With iOS 8 and Mac OS X Yosemite, developers will be able submit apps using Swift to the App Store and Mac App Store in the Fall. This has implications for every business that produces Apple apps. Business managers and developers should consider now how to best make that transition.

Do you and your team have the necessary resources available (e.g. time, budget, etc.) to commit to learning, prototyping, and testing Swift source in your project? Is there someone on your team or in your company that can learn and serve as a Swift expert? Do you have a requirement to support iOS 6 or Mac OS X Lion (which will not run Swift apps)?

One way a team can experiment with minimal impact is writing test cases. The new XCTest classes have Swift equivalents. So, a team can write small chunks of code to add unit tests to an application while they learn how the language interacts with their code.

For some businesses Swift offers new features that provide very compelling reasons to be an early adopter. Are there specific features of Swift that will benefit your products? According to Apple's WWDC announcement, Swift provides a host of new features including fast and concise iteration over a range or collection, structs that support methods, extensions and protocols, and more. Developers should decide if and when it makes sense to move towards implementation of features like these.

Also, are there third-party source files in your project that will need to be updated? If so then you will also want to think about how to commit resources to research and transition those at some point.

Moving Forward

Let's be honest - this can be a little overwhelming, and yet the prospects of moving to a simpler more powerful language are very exciting.

Steve Jobs once said

"The over-all point is that new technology will not necessarily replace old technology, but it will date it. By definition. Eventually, it will replace it. But it's like people who had black-and-white TVs when color came out. They eventually decided whether or not the new technology was worth the investment."

Obviously each business and developer will have to think through how and when transitioning to Swift will move their projects forward.