Apple’s Swift programming language has been taking the iOS programming world by storm. Now that it has been released as an open-source project, it is also poised to move on desktop and other mobile device platforms. Should you choose Swift as the development language for your next iPhone project?
Apple is doing their best to make your answer “yes.” They are also trying to make the choice an easy one for existing development shops which have already invested heavily in Objective-C (the previously de facto coding choice for the iOS world). Swift is designed to operate seamlessly with Objective-C, despite being a radically different language. Existing Objective-C apps can be augmented with Swift code, since both can exist and compile within the same project. This allows developers to mix and match, picking their preferred solution for each particular programming problem, as well as allowing developers with different language fluencies to work together on the same projects.
Swift is also designed to stand alone:
It is designed to be much easier to read and learn than Objective-C, and consequently, easier to maintain. It’s also designed to do more to protect programmers from themselves–Swift has powerful features built in to help coders detect and correct possible null reference exceptions and unpredictable errors before they ever release their code. The language is also less verbose than its older brother, requiring fewer lines of code to accomplish the same tasks.
Because both Swift and Objective-C rest heavily on Cocoa, Apple’s API (Application Programming Interface) and shared library that makes the Apple platform experience what it is for users, there’s no functional difference to end-users. They’ll never know what the underlying language is of the app they are using, which is just as it should be.
Swift is faster to compile and to run:
Swift is currently on the second iteration of the language. Drawing the ire of some early adopters, Apple essentially gave the language a top to bottom review after version 1.0, introducing changes across the spectrum, from error handling to improved Objective-C integration. Although early Swift apps sometimes required extensive rewrites, the resulting language has proven faster to compile and to run.
Furthermore, iOS isn’t the only platform that Apple is pushing Swift for. The language also works seamlessly on OS X, and Apple hopes to pull in more cross-platform developers by unifying the language across its product lines.
Currently, the major drawback for organizations interested in moving to Swift as their default language choice is a lack of skilled developers. The demand for Objective-C developers has been such that there had been little financial incentive for coders to adopt the new language. Many talented amateurs have begun learning to code in Swift, but it is a risky proposition to take on an inexperienced coder for an important software project.
This, however, is where the Objective-C/Swift integration comes in handy. Experienced Objective-C programmers can still be used as leads on new app programming projects, but less experienced Swift programmers can be brought in to participate as well. There is a soft ramp up to speed for the new developers, and an inherent learning opportunity for the more experienced staff.
It’s also relatively easy for existing Objective-C developers to make the jump to Swift if they so choose. Swift does not change any of the essential iOS programming design patterns. Because it tends to be easier to learn and more readable, the technical details of the language are easy to pick up, and the basic architectural structures of apps remain the same.
Swift is the obvious choice:
Although Apple continues to support both languages strongly, the writing is on the wall for Objective-C. Few new developers will be trained in that language and many existing projects will be gradually migrated over to Swift as the environment shifts to favor Swift coders. Inevitably, Apple will devote more time and effort to improving and promoting Swift than maintaining Objective-C.
For organizations looking to develop a new app from scratch, Swift is the obvious choice. Businesses faced with maintaining and upgrading existing Objective-C apps may hold off on a full-scale Swift adoption, but it would be wise to start dipping toes into the new language as soon as possible to avoid being caught out entirely when the tide turns on Objective-C.