Five Myths About Swift

Swift is still a very young technology, but there are already a lot of myths about Swift.

Myth #1: “Swift has weak typing”

Many people think that Swift has weak typing. The reason for that is that you can declare the type for a value implicitly:

It looks like  i has no type, but that’s not true! Since 5 is an integer value, the compiler makes the variable to an integer variable. And after that, this cannot be changed anymore!  i is and always will be an integer value.

However, it is of course possible to do an explicit type declaration:

Although this is not necessary, it improves the readability of the code.

Myth #2: “Swift has a bad interoperability with Objective-C”

Many people don’t want to give Swift a try because they think that they cannot use existing Objective-C code and libraries. But that’s not true. It is possible to use both Swift and Objective-C in the same project. And it is also possible to use Objective-C third party libraries in Swift code.

You can declare Objective-C header files in the so-called bridging header file. Then, all headers are translated into Swift syntax so that you don’t see any differences in using Objective-C API. Even the Objective-C error handling is converted to the new  do-try-catch syntax.

Apple’s frameworks are still written in Objective-C so it would be very bad, if Swift had an bad interoperability with Objective-C.

Myth #3: “You have to use Swift for new projects”

I think it is a very good decision to use Swift for new code. At least every serious iOS developer should learn Swift.

However, you don’t have to use Swift for new projects! Objective-C is still completely supported by Apple. And this won’t change at least for a couple of years. Though I believe that at some point in the future Apple will lower the support for Objective-C.

Take a look at my blog post “Should You Use Objective-C or Swift?” for more details about this topic.

Myth #4: “It is enough to learn just Swift”

Although Swift is a very good language, which you can use for production code, it is not enough to learn just Swift. Since Swift has a very good interoperability with Objective-C, there will be very often Objective-C code in projects. Also a lot of code examples and tutorials are written in Objective-C.

So in order to become a very good iOS developer, you have to learn both Swift and Objective-C.

Myth #5: “Swift is not ready for production yet”

People think that Swift is not ready for production yet. One reason for that is that there were some problems at the introduction of Swift. Especially Xcode had some annoying bugs. Tough it was still possible to use Swift for production right form the beginning, if you knew some workarounds.

On its way the syntax of the language changed twice with the introduction of Swift 1.2 and Swift 2.0. So it was necessary to migrate existing Swift code to the new syntax. But this  shouldn’t be overrated because code changes are necessary with each new iOS version anyway.  And it is a good sign that a language is trying to improve – especially at the beginning.

Where To Go From Here

If you want to learn more about Swift, a very good starting point is Apple’s Swift book. For other resources take a look at my blog post “How To Stay Up-To-Date On iOS Development”.


Image: @ Gustavo Frazao /

Book Tip

Big Nerd Range Guide: iOS Programming: Excellent introduction to iOS development. Some programming experience is recommended.