Why Developers Should Embrace Apple's Swift Language

When Apple showed off their new programming language, Swift, at WWDC 2014, it was a game changer for developers who want to develop software for Apple products. John Gruber was right when he said "This is huge news". Swift has the power of traditional general purpose languages like C and C++, but it also has the elegance of a scripting language like Python. Swift will also attract developers to write software who would have never developed applications for the Mac or iOS platforms.

Objective-C has been the primary language used to develop software for Mac OS X and iOS since both of those products launched. While Objective-C is a powerful programming language, it has terse syntax that makes it largely unapproachable to most mobile developers. Many of the developers I know who are proficient at writing Java or C# have shied away from learning Objective-C because of its use of pointers and square bracketed method calls on objects. The have instead chosen to use tools such as Xamarin, PhoneGap, Unity3D and even Flash to develop mobile apps and games.

Objective-C was designed in the early 1980s as a way for C programmers to write object-oriented code for their applications. While Objective-C was revolutionary, and easier to learn than C++, it still has all of C's warts. Computer Science is constantly evolving, and Apple needed a language that could take full advantage of the LLVM compiler, and also have the same features as the newer languages that have developed over the last 10 years. COBOL used to be the primary programming language of enterprise development, but it has been replaced by languages like Java, C# and Node.js.

While it is true that there are many great tools like Xamarin, which let developers write apps using C#, you still have to be familiar with the iOS APIs when writing your apps. Developers can share some code between platforms, but they still need to be familiar with the existing frameworks. PhoneGap is also an excellent tool which lets developers who are familiar with web technologies like HTML5 and Javascript. PhoneGap creates a wrapper for a web view that exposes some of the APIs available on modern smart phones like the GPS. While Apple and others have done a great job of improving the performance of Javascript on iOS and Safari, this code does not even come close to matching the speed of native code. Steve Jobs originally intended on app developers just using HTML5 and Javascript to build apps on the iPhone, but developers balked at that option.

Learning a programming language is a very small part of learning how to develop software, it is also learning and becoming familiar with all of the frameworks and libraries that are available on that platform.

At the end of the day, software developers want to have access to the same APIs that Apple does when they build their software. They also want to have the best speed and performance available on the platform their apps run. Mobile devices do not have the processing power or memory of their desktop cousins. This is another reason to use the native tools for the platform. Apple also provides excellent tooling in Xcode for profiling memory and performance using C++, C, Objective-C and now Swift.

In their book The Pragmatic Programmer: From Journeyman to Master authors Andrew Hunt and David Thomas suggest learning a new programming language every year. This is sound advice. If you are going to follow this advice, I would suggest learning Swift. Apple has an eBook, and an excellent introduction at Apple's developer site.