Dev

Swift is great, but you should still know Objective-C first

iOS 8 iphone ipad
Image Credit: Apple

Apple sent waves through the developer community on Monday when it announced Swift, a new programming language for iOS and Mac OS X apps that’s designed to be fast, modern, and easy to learn by limiting the amount of boilerplate code needed to solve and debug common problems.

With the growing popularity of script-like dynamic programming languages such as Ruby and Python, it makes sense Apple is taking this leap with Swift.

And, because it’s backed by Apple, every iOS developer should eventually learn it. That said, I believe Objective-C is not going away anytime soon, and learning it is still a solid investment for anyone who wants to build iOS apps. Here are a few reasons:

  1. The frameworks aren’t changing: iOS apps are made by writing code that accesses the Cocoa Touch framework. This framework contains functions that allow developers to draw images and text on the screen, respond to user interaction, make network requests and control the device’s camera, among many other things. The way developers need to interact with this framework is separate from what programming language they use.In a large sense, when you hear that you “need to learn Objective-C” to make iOS apps, the majority of what you’re learning is how to use the Cocoa Touch framework. (Note: mentions here of iOS and Cocoa Touch also apply to Mac OS X and Cocoa.) The difference is that now, with Swift, you have one more way to use that framework.
  2. Objective-C is tried and tested: Every single app in the App Store today is written in Objective-C. As Apple CEO Tim Cook noted in Monday’s keynote, right now that’s around 1.2 million apps created by some of the 9 million registered Apple developers. That’s a lot of Objective-C code out in the wild, and it’s not likely developers will all jump ship on Objective-C and recode everything in Swift — especially medium-to-large companies that have already invested millions in the development and maintenance of their existing apps.
  3. The learning materials are mature: There are already a lot of educational resources, such as books, videos, and yes, even online courses such as Code School, to help you learn the ins and outs of Objective-C and Cocoa Touch. More importantly, since Objective-C is such an established language, developers have had time to discover and share the most useful patterns and best practices. Swift learning materials will certainly reach this stage too, but you’re sure to hit some frustrating walls if you try to dive in head first this early without a backup plan.
  4. You can use both: Swift is designed to work side-by-side with Objective-C code in Xcode, which is Apple’s primary development tool. That means developers can incrementally re-write their apps for Swift, and it’s not an all-or-nothing situation where all Objective-C code needs to be immediately thrown out. This also means any time you’ve devoted (or will devote to) learning Objective-C is still time well spent.

The bottom line is this: If you’re a new developer looking to make iOS apps, learning Objective-C allows you to tap into all of that history and get a strong foundation in the Cocoa Touch framework’s libraries, which will help you pick up Swift once you’ve got a good foundation.

If you’re a seasoned Objective-C developer, you’ll be able to learn Swift with some practice, but you won’t need to suspend using Objective-C in a way that stifles your development team’s productivity. After all, the output of both languages is identical — a beautifully designed and functional iOS app running on one of the greatest mobile devices in the market today.

Jon Friskics is an Objective-C and aspiring Swift developer, and iOS course instructor at Code School, an online learning destination for existing and aspiring developers that teaches through entertaining content. Code School has more than 40 courses covering JavaScript, HTML/CSS, Ruby and iOS. Contact Jon at jon@codeschool.com or on Twitter at @jonfriskics.


Mobile developer or publisher? VentureBeat is studying mobile marketing automation. Fill out our 5-minute survey, and we'll share the data with you.