"So I want to start iOS Development... what language should I choose?"

This is quite possibly the most common question i've seen in the months since the announcement of Swift. New developers used to have to endure Objective-C through to competency but now there is choice. So which choice is the right one? Objective-C or Swift?

What they say

The internet as a whole have very strong opinions on this subject, what I find interesting is that most people will still recommend that you start with Objective-C before learning Swift. Their reasoning seems mostly centred around "You learn the roots of iOS development and there are more resources available", I'm not sure I buy that argument at all though.

Objective-C may have more tutorials etc from previous iOS versions but when you look for iOS8 tutorials or guides almost all of them are written in Swift, even big iOS training blogs and companies have abandoned all Objective-C based courses to focus entirely on Swift. The Swift information available is quickly growing, it's rare that StackOverflow doesn't have a solution to a problem already and the rate at which resources are getting pumped out is incredible.

The other common argument is "It doesn't matter which language you choose, it's the frameworks that take most of the time to learn and what you learn is interchangeable". I do agree with this statement to an extent. It's important to focus on what you want to create and the language is really just what is best to perform the task, make decisions based on your objectives. That does make the language important when there is a clear winner regardless of the type of app.

What I Say

I've been using Objective-C for years and it's always been a love / hate relationship. There are things it does really well and a handful of big stumbling points but overall it felt good to work with. If I was to start iOS development today without any prior knowledge of the environment, I would definitely have to pick Swift though for the following reasons:

  • Resources and Training : As mentioned above, there is an amazing amount of resources available already on Swift and on iOS8 specifically there is more Swift content than Objective-C.
  • Ease of Learning : Another common myth spread over the internet is that both languages are equally difficult to learn. I disagree, each language has complexities but Objective-C is complex due to years of legacy design issues which come from building a language on top of an existing language. Simple things such as declaring variables can be done so many ways and have so many implications on memory management. Swift is logical and structured which makes even complex concepts much easier to learn than illogical problems based on legacy issues. Features such as the Swift Playground also make it really easy to prototype ideas and learn code quicker.
  • Robustness and Safety : You've seen the slides comparing speed and resource management before, I don't need to repeat them but it's definitely a strong consideration. If you could shave seconds off of loading screens at the point of initial design of your app, wouldn't you?
  • Time Management : Aside from most likely being able to get up and running faster you should also be able to develop faster with less wordy syntax and more optimised ways to code.
  • Potential to Grow : Objective-C is really at the ceiling of it's potential, would you really want to sink your time in to learning something which won't have the new powerful languages features the other language will have in one or two WWDCs time?
  • Eventually the String will be Cut : As it is, you can learn any framework in both Objective-C and Swift, how long do you think it will be before a new and powerful framework becomes available which is only in Swift? For all we know right now WatchKit may be Swift only. This may sound radical but the last thing Apple would want is resource hungry apps on this minimal resource device, by using a more compact and type safe language they can enforce a certain level of quality which they couldn't previously.
  • Stability : As of writing this Xcode is still going through some growing pains as it adapts for the future. Both Objective-C and Swift are at a point where they are fairly stable though, while at the beginning Objective-C was the clear winner that is no longer the case.
  • Apple Care about Training : Objective-C was always very hardcore developer focused which meant the learning curve was steep. With Swift Apple were quick to create easy to digest manuals and even keep a blog where they have started adding video tutorials.
  • Future Intension : If you are planning to learn Objective-C first then moving to Swift then this won't be an easy transition. As found by a lot of developers converting apps from Objective-C to Swift, if you do a straight conversion you're going to have a bad app. You need to have a good understanding on Swift paradigms and design patterns in order to write good apps in Swift. Knowing Objective-C is actually a disadvantage when it comes to writing good Swift.

What reasons should you be cautious about Swift for though?

  • Rapid Development : Depending on your personality this might be a pro or a con, Swift is young and not quite at maturity, it's likely parts of the language will continue to change and new features will be added fairly frequently. With Objective-C no major changes happened between major versions of iOS but with Swift it's likely to change a lot. If you can keep up, this might not be a bad thing.
  • Legacy Software : All the above points are null and void if you are planning to be hired or have been hired by a company that want to maintain a pre-iOS8 app make in Objective-C or an Objective-C library.

Why not learn both?

As suggested above there are different design patterns and paradigms in place in both languages and investing time in learning both may lead to a difficult and confusing learning curve which in the end will leave you a jack of all trades but master of none.

If you are an existing iOS developer then it makes sense to keep up on development in Objective-C and keep using it to stay sharp. Objective-C developer jobs are likely to be around for a while as legacy apps are updated, there are millions of them out there and not all will adopt new technology.

Final Thought

Don't lose sight of the big picture, the product is the important part but I honestly believe moving in to the future that Swift will be the better engine to ensure the longevity of your product and help it grow technically.

The longer existing developers wait to embrace Swift, the further behind they will be when the inevitable forced transition occurs (forced via required features not via Apple). I look forward to seeing how the language develops over the next few years, you can jumpstart your Swift immersion by subscribing to my newsletter at swift-coder.info.