Why Web Developers Shouldn’t Learn Swift

Swift

Swift being introduced

 

When Apple introduced Swift at this year’s WWDC, a lot of the sentiment on Twitter was that they’re looking to make developing apps for iOS a lot more accessible to developers, that don’t want to bother with lower level concepts, like pointers.

The idea being that web developers, who happen to know C#, Ruby, Javascript, etc would have an easier time migrating to Swift, than Objective-C, thus getting some fresh developer blood into the Apple app maker camp. And while you can definitely see how that’s a good idea, I’m here to tell you why you, as a web developer, you shouldn’t bother with Swift.

First up – full disclosure, I make my living by writing apps for iOS, thus far utilizing Objective-C, but excited to see what Swift has to offer to iOS developers.

Let’s see what the current landscape on the iOS side is, you have two choices:

Learn Objective-C and start developing apps

While it’ll (probably) take you longer to come to grips with the lower level syntax, weird brackets, lots of interspersed straight up C code and what might be a confusing set of memory management rules, this currently might be your best bet at getting into iOS development.

Objective-C isn’t going away anytime soon, it’ll be years before Swift completely takes over and even then, you’ll probably have to deal with a lot of legacy Objective-C code. Adding to the longevity of the language, is the fact that at the moment there’s a lot of functionality that you can’t do in Swift, that you can in Objective-C. You’d have a hard time, if you’d like to write the next CoreData in Swift, for example.

Learn Swift and start developing apps

Swift has been developed in secret and thus a lot of Apple’s engineers found out about it at the same time that you did – at WWDC’s keynote. That means that a lot of the other teams employed at Apple haven’t had the chance to have their say about the language’s functionality and how it’ll fit in the frameworks that they’re responsible for.

With Swift being Objective-C, without messages there’re a lot of unanswered questions, like will Apple rewrite their frameworks in Swift to take advantage of the speed boost that they outlined in their presentation? If not, would Swift just be a wrapper around all of their existing frameworks? Can they rewrite some of their frameworks without the use of Objective-C’s dynamism, while preserving the same functionality?

Without the concept of Key-Value-Observing in Swift, how will the classes in Objective-C, that rely heavily on KVO to interact with, work in an all Swift environment? (I’m looking at you, AVPlayer)

As you can see, right now Swift is in a sort of a beta state, there’s a lot that’s currently missing (but being planned on), like access modifiers and there’s a lot of uncertainty.

What’s certain is that if you choose this option, you’ll likely have to learn Objective-C, being that a you’ll be using it a lot, albeit through Swift.

And with retain cycles still being a thing in Swift, people that are used to the comforts of a garbage collector, are in for a whole lot of headaches.

So right now, if you’re a web developer and are looking to get into all of this, I’d recommend that you just hold off and instead stick to your strengths.

With WebViews getting the Nitro engine in iOS8, the addition of the fourth tier LLVM JS compiler and WebGL enabled by default, web apps and hybrid applications have never looked better. Sure, your apps probably won’t be as fast as being native, but all you need is for them to be good enough. And with Android 4.4’s new webviews, you might just be able to offer better performance for Android users as well.

So in conclusion:

Web developers, stick with what you know for now, while keeping an eye on Swift developments.

Native developers, you better start learning Swift ASAP, if you don’t want to get left behind.

Posted in

3 Comments


  1. Thanks for your insight Andrew! It was interesting to read this straight from an Objective-C developer.

    Reply

  2. Language syntax was never the “problem”. Cocoa framework gives complexity to iOS projects and scare newcomers. But developers are in general pretty smart and dynamic people, this shouldnt be a problem.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *