An Introduction to Swift Programming
Very few people who have delved into Apple’s programming domain develop an opinion that one could describe as neutral on the topic of Objective-C. Objective-C draws the ire of many, and the love of a small band. To understand the swift direction away from Objective-C that Apple now follows, one must first understand the nuances of Objective-C that drove the company to create a new language.
The Nuances of Objective-C
On some measurement systems, Objective-C falls in between the minimalistic C++ and the high-level interpreted languages of Ruby and Python. It allows for dynamic binding through message passing by default. Dynamic typing also offers another distinctive feature. Combined with forwarding messages, this ability allows for quick implementations of certain design patterns. Many changes can occur at run-time, especially given Objective-C’s notion of categories – a patch of methods used to extend an existing class.
Many of these features make Objective-C a quirky, but sometimes lovable language. With the sugar comes the bitter taste of many flaws, however. Global namespaces, gruesome syntax for string manipulation, method visibility concerns, and a host of other oddities reveal the language’s age. In short, Objective-C may have lasted until 2014 as a major contender due solely to Apple’s continued support with the contribution of large frameworks that patch many of the pitfalls. What started as a small layer on top of C has grown as a series of patches in the namespace only, and for this reason Apple now crowns a successor.
Apple built all of these features into Swift. Unlike Objective-C, these constructs are not frameworks that patch an underlying language, these are embedded language features. Swift does not support message passing as common practice, although the feature does exist. From the list of new features, it may seem apparent that Apple paid close attention to the competition in deciding what to implement in Objective-C’s successor. Swift is a language that fits into the modern mold, and provides enough of change to merit replacing Apple’s old workhorse.
As it was in the past with Objective-C, my opinion gives only modicum weight to the language. If you are interested in developing Apple software you will learn Swift at some time, regardless of its success in popular opinion. I believe, however, that many programmers have found Swift to offer a sleek and modern approach compared to the well worn ancestor. Apple certainly delved deep into the insights that developers learned in the past working with Objective-C, and into the success of other languages. And so, to Objective-C we may not say “Good riddance,” for the sake of so many memories, but at the very least, we may soon say “Goodbye.”