Hello people,

There are a lot of talk out there about the Swift. As always, Apple reach the trend topics with its biggest announce: "a new programming language, I introduce you Swift".

I've seen people getting scared, screaming, jumping the window. Calm down people, my sincerely word for you is: Swift is GOOD! I'll explain here why Swift is a good thing and why you should not worry if you don't want to change.

As Swift still under the Apple's NDA, this IS NOT a tutorial about Swift, it's just a clarify and word of relief for the afflicted ones. But as soon as it goes live, I'll immediately post LOTS of tutorials about Swift.

The first important thing is: Do not get confused between Apple Swift, OpenStack Swift storage (http://swift.openstack.org), another scientific project called Swift Language (http://swift-lang.org) or any other references to the name "Swift", yeah, this name is too generic.

Well, there are 3 myths that Apple are trying to introduce to scare people that I'll demystify here:

  1. Swift is faster than C and Objective-C (MYTH)
  2. You can learn Swift faster than Obj-C (MYTH)
  3. You can make everything with Swift (MYTH)

1st MYTH - Swift is Faster than C and Objctive-C

Apple shown this image in the WWDC 2014 keynote:
Swift VS Obj-C
Despite the countless test I've made and saw others doing in performance field with Swift, I'll focus on something below the surface, something that really prove this image is a lie. (But just to let you know, in the performance tests, Obj-C still the winner).

Since the very begining of the computer science and technology, our human knowledge is limited by the physical materials. I mean, every single computer in this world operates on a plastic board, with circuits made with copper and other metals. The magic happens when very small eletrical impulses start running through the board. To these impulses there are only two possible values: or they exist (1) or they don't (0). This is the binary world, the Processor tracks those impulses countless times per second (well, of course it's not real countless, but you get the meaning).

The Quantum computer is a reality, but I'll not go deep in this subject, which is really the only way to take our current computer science to a new level. By changing the binary logic to another logic with -1, 0, 1 and everything between those values. Anyway...

So we know that working with bits is the fastest way to work with the traditional computers, because bits are the real processor's language. Now, you probably know that Obj-C as a superset of standard C and works with "pointers". I'll not go further in this subject too, but we all know that working with pointers is the way to direct slide through the bits in the memory, which means, working directly with bits. Back to the processor, nothing can be faster than working with bits in a traditional computer. So, the BEST a new language could achieve in performance is EQUAL to C, but never FASTER than C.

This is the first point: Nothing is faster than C in a traditional computer, just EQUAL in the best case.

But why Apple shown this graphic? It's a lie? Not exactly. As everything that Apple does, this image is a marketing piece intended to be used in their marketing WAR.

It's true that the greatest part of the developers doesn't know C and Obj-C structure in deep, which lead them to make mistakes, which lead the final app to have a poor performance. So to 90% of the apps, which are made by beginners, using Swift will avoid to make mistakes, avoiding bad performance and bad algorithims. So if you compare the app performance of an ordinary developer using Obj-C and Swift, yes, Swift will be faster. But if you compare the code of an experienced developer using Swift and Obj-C, nothing will really change, absolutely no performance gain. In fact, as many test have proved, the performance could even be worst, because Swift translation will never be smarter than a good C developer.

So, saying Swift is faster than Obj-C is a big LIE, but for Apple it's a marketing Weapon and will be used as that.

2nd MYTH - The learning curve is better in Swift

In a far future from now, maybe this phrase becomes true, but not now. Not even closer. You can't do everything with Swift. The Next Step legancy still until today and it's HUGE. There are so many frameworks in Apple that is using the NS base that is insane try to refactor everything. So Apple will just let it as it is.

Again, this means that for beginners and ordinary developers, Swift will do many things, but when you try to make something a little more sophisticated, like using the new Metal API (a 3D graphical lib, the new Apple competitor for OpenGL), you'll notice that Swift is not enough, because Metal is not even compatible with Swift. You must know and learn about Obj-C, C, MRC and everything else that Apple is trying to hide from us.

So, in a marketing perspective, Apple just make the first step in his development world a little bit easier, but as soon a new developer try to make a small feature similar to a great app, BAM... he will notice that there is no way to achieve that without go deep in the Obj-C world.

As soon as you start mixing Obj-C and Swift, you will find how exponential this learning curve can be. You'll need to learn two languages at once and learn how to mix them. As a marketing strategy for Apple, this can be dangerous.

3rd MYTH - You can make everything with Swift

As a consequence of what we discussed above, Swift is far from ready to do everything that Obj-C and C does. It does not have all the frameworks and its integration with Obj-C is not really a FULL integration.

Let me explain: the communication between Obj-C and Swift is made using a pre-compiled code that is taken by Xcode as Swift code. Apple called this feature of "Objective-C Bridiging", which is nothing else than a header for pre-compiling your Objective-C code. This means the Old C and the new Swift can live within the same project, but not within the same file as Obj-C and C could. (BTW, Swift has a new file extension ".swift", Apple always like to use long extension files, instead 2 or 3 letters). The backward already exist, Xcode automatically put a suffix in all your Swift classes and objects calling them as "-Swift".

Do you know why this "Objective-C Bridiging" can exist? Because the Apple compiler LLVM 6.0 converts all the Swift code to basic Obj-C/C code during the compilation. Yeah! So your app on iPhone still running the same kind of runtime, the same compiled code, Apple didn't change anything down there. This is another clue about the first MYTH (about Swift not being faster than Obj-C in real).

Just one more word about this subject, we can totally understand why Apple didn't change and probably will not change anything on runtime. I've been through few runtime changes in my life and I can say, it's very painful. AS2 to AS3 (Action Script), changing the runtime means completely give up of the current applications, means refactoring the entire project, which can kill thousands of business and companies. The old ASP.NET to .NET C#, these change was much more painfull than Flash.


  • Is Swift cool? YES
  • Will Swift grow fast? Probably
  • Learning Swift will be fast? YES
  • So can we give up Obj-C? NO

This is the bad news for beginners, they will must learn two languages instead of one. Doing ordinary apps anyone can do, PhoneGap and Titanium can do ordinary apps. But I'm not talking about this level, I'm talking about the real development, the one that can bring you awards, the one that can change things, the special ones, TOP apps. For this level, you can totally give up of Swift for now.

© db-in 2017. All Rights Reserved.