Dev

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

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.
24 comments
Stephen Matthews
Stephen Matthews

"Every single app in the App Store today is written in Objective-C" I have two apps written in ActionScript 3 AIR for iOS one is 'kaleidr' which makes super lovely creations. People write in HTML5 but those apps are mostly web pages with some local resources. Many games are written in AS3 as we can now ( for a while actually ) access the hardware accelerated parts of the devices. You can even have threads in AS3. Ah oopss i didn't read any comments before posting.

Jon Friskics
Jon Friskics

Author here.  Thanks for pointing out that not _all_ apps in the store are written in Objective-C (Xamarin, RubyMotion, PhoneGap, etc.).  Those are valid tools too, and I didn't mean any disrespect to those platforms and their developers.  Perhaps it would have been better to have said "none are currently written in Swift".  The point I was trying to make is that right now Objective-C is overwhelmingly the go-to for app developers, and it's worked pretty well for them so far.  Whichever side of this argument you fall on, make sure that you continue to have  fun learning (and helping others learn) to build iOS apps!

Steven Fisher
Steven Fisher

People also suggest you learn manual release/retain (MRR) before using automatic reference counting (ARC). I used MRR for years, and it really didn't help me learn ARC. What helped me was understanding the object graph model, which was actually HIDDEN by MRR. I think knowing MRR makes it harder to learn ARC.

Just looking at it and playing for a few minutes, I think Swift is another great example of this. Swift is a teaching language that's actually more useful for day-to-day programming tasks than the language it replaces.

If you're a new developer reading this, ignore the article. Get the concepts down and learn the language you're going to actually use.

You can learn the frameworks in Swift just as easily as Objective-C, Swift will be tried and true before you know it. The learning materials and code examples are already appearing. And just because you can mix languages if there's a reason for it doesn't mean you have to.

Fiqri Ismail
Fiqri Ismail

May be he's scared of loosing his job  ... 

Emil Picasso Gentolizo
Emil Picasso Gentolizo

Actually, everyone needs to know and use UX / UI best practices. I'll even volunteer to write that article for you :)

Joshua Darlington
Joshua Darlington

"Jon Friskics is an Objective-C ... instructor at Code School"

Jae Yoon
Jae Yoon

You should really know Assembly first

Juan Carlos
Juan Carlos

Not true...Not every single app in the App Store is written in objective-C!

Kevin Mullen
Kevin Mullen

Not true that every single app in the app store is objective cp.... many are html5/phonegap

Stephen Matthews
Stephen Matthews

@Fiqri Ismail 'loose' shorts make the runner 'lose' the race :) sorry :) I'm sure I have boo boos in my posts too.

Jon Friskics
Jon Friskics

@Fiqri Ismail There's a lot of languages, tools, and frameworks out there, and we're more worried about how we can possibly cover it all vs. not having enough to teach :)

Lasse Rafn
Lasse Rafn

Yes. They are. You CAN NOT get apps in the Apple App Store NOT written in Objective-C (well, now you can with Swift)

Tien Do
Tien Do

@Kevin Mullen I guess you never write any HTML5/Phonegap app and just reading some easy tutorials :)

G D
G D

@Kevin Mullen They're wrapped in UIWebView views but the underlying framework is Obj C.

Evgeniy Tokarev
Evgeniy Tokarev

@Lasse Rafn many of apps in AppStore is a pure C++ applications with small Objective-C platform specific wrappers, also lot of games is written on Unity3d which is used C#/mono, also lot of other technologies available like Xamarin/C#, RubyMotion and even lisp (https://wukix.com/mocl)  

Jerome Touffe-Blin
Jerome Touffe-Blin

@Lasse Rafn Wrong. You can develop app in html5, javascript as well with something like phonegap or Titanium. Apple also published a Javascript bridge last year to allow developing app in Javascript.