Swift: The New Programming Language For Your Next App

By July 17, 2014 April 8th, 2019 Development, Enterprise Mobility


At the Worldwide Developers Conference (WWDC) held in June 2014, Apple introduced a revolutionary, new programming language for Mac and iOS developers. The new language is called Swift, and it allows developers to create apps faster and more efficiently. Swift will give Objective-C developers access to an easier and more robust language and will also attract new developers with backgrounds in scripting languages, such as Python or JavaScript.  The real challenge will be to see if Swift can be used to create successful projects and transition existing Objective-C apps to make use of this new language.

“We had to ask ourselves the question: What would it be like if we had Objective-C without the baggage of C?” -Craig Federighi

Swift is fast and more resilient to erroneous code, not to mention it has concise syntax, making it a very powerful option for any iOS or iOS X deployment.  Swift includes a number of new features and over 4000 new APIs to leverage. On top of all that, Xcode 6 has a testing area called “Play Groundsthat supports Swift– it provides a quick and simple way to test classes, functions, views and algorithms while getting instant feedback.


Playground Sample – Image by Apple.

Included in Swift’s bag of goodies, are ClosuresGenerics, Namespaces, Type Inference and multiple return types, among others.   Swift is a strongly-typed language by default; however, it also uses type inference which again reduces code length for developers. The strong type attribute is always in place unless specified by special keyword weak.


Objective-C vs Swift
WWDC 2014

While Swift has a number of great features, its most important characteristic is that it uses the LLVM compiler and the Objective-C runtime.  This means that all new development using Swift will be compatible with Cocoa, Cocoa Touch frameworks, C, and Objective-C’s APIs and code bases.  This is great news for people currently working on individual or enterprise Objective-C projects. If you are looking to transition and take full advantage of the full stack of features, Swift makes it possible.

Let’s talk about the three key features that simplify the transition to Swift:


Going along with its definition, “…able to exchange and make use of information,” this great feature creates an interface right between Swift and Objective-C. Developers can use Swift classes or pieces of code inside Objective-C and vice-versa.

The beauty here is that we can take full advantage of the patterns and practices implemented in both languages while still keeping the syntax native to Swift or Objective-C.


Interoperability Example – Inherit from Objective-C class. 
Image By Apple

Mix and Match

Mix and match allow developers to combine different code files in the same project. In other words, developers can create a portion of functionality using .swift files and attach it to a project built in Objective-C code that uses .h and .m files. These files can coexist within the project. This is great for transitioning existing projects to the new language by picking and choosing what pieces of functionality to enhance or create with Swift. In addition to this, building new projects in Swift allows the flexibility to create bits and pieces in Objective-C, if Objective-C is more suited to particular tasks.


mix and match 
Image By Apple


This feature allows developers and architects to take an existing Objective-C project and enhance the architecture and performance by converting it to Swift. The good thing is that developers can accomplish this without having to rewrite the entire app. This is made possible by a combination of the previously-mentioned features.  The optimal way to  perform a migration is to switch files on a per class basis.  The end result will be to switch the .m and .h files into one .swift file which will contain all the implemented functionality. Developers would not have to implement a header file, as Xcode handles this for them when working in Swift.  As the integration takes place, Xcode allows you to set Swift classes that can directly interact with subclasses of an Objective-C class.


Objective-C bridging header
expose class information to Swift
Image by Apple

Even though developers can use features to interact between Objective-C and Swift,  Objective-C cannot access some of Swift’s unique features, such as:

  • Generics, Tuples
  • Swift Enumerations
  • Swift Structures
  • Swift Top-level functions
  • Swift Global variables
  • Swift Type aliases
  • Swift-style variadics
  • Nested types
  • Curried function.

Swift Adoption Rate

According to Tiobe Software,  in July 2014,  a month after its release,  Swift entered the 16 index position as the most used programming languages. This measuring index system measures programming language use on a per month basis. It’s too early to determine if this number will increase or decrease, as Swift is still in its testing period; however, considering the qualities and features of the language and considering the use rate of Objective-C, we can expect Swift’s popularity  to increase and potentially surpass its sibling.


Swift Index
Image by Tiboe Software.

Go Swift

Swift looks very promising and exciting. In my opinion, Swift  is not just a programming language that is trying to fit in a saturated market of programming languages- it is a language that looks forward to facilitate the creation and continuation of successful apps. Apple took into consideration metrics that matter to individual and enterprise Software Engineers, such as time, resources and quality. As a result, Swift will be an attractive way for people to utilize iOS development as part of their development process.

Want more?

At Bluefletch Mobile we stay up to date with the latest and newest technology to the point of becoming matter experts in all aspects of mobility.  We are currently adopting and trying out Swift in its Beta state. Keep on the lookout  for further posts on Swift and other relevant topics.

If you are interested in further reading about Swift, these books are very useful.

The Swift Programming Language
Using Swift with Cocoa and Objective-C


By Andres Avendano



Related Posts

Andres Avendano

Andres Avendano

Lead Developer - Andres Avendano is a developer specializing in web & mobile development with a passion for aeronautics. Andres has skills in C#, Java, Ext JS, HTML5, iOS and Android. He also has his private pilot certification and working on an instrument rating certification. Andres holds a BS in Computer Science from Georgia State University.