Apple Wants Devs To Love Swift, Its Shiny New Language—But There’s A Catch

Apple has high hopes for Swift, a brand-new coding language it unveiled for its developers on Monday at its Worldwide Developers Conference. To Apple, Swift is a simpler, safer, faster-to-run alternative to the somewhat clunky and error prone language Objective-C now used to write apps for iPhones, iPads and Macs.

Essentially, Apple is wagering that Swift will save enough time and effort that it might encourage more developers try their hand at building iOS apps. So Apple would clearly like to see developers learn and adopt Swift—well, swiftly.

If only it were that easy.

With Swift, Apple is performing a complicated straddle between its current technology—the language and tools that developers are familiar with—and its shiny new language of the future. Swift certainly offers a number of attractive new features, including automatic memory management intended to kill off a class of insidious bugs that plague Objective-C, a “playground” feature that visualizes a program’s actions for easy debugging, and a simplified syntax designed to be both easier to learn and less prone to error.

But to maintain continuity with existing apps, tool suites and code libraries, Swift also snuggles up close to Objective-C. It works directly with Cocoa and Cocoa Touch, the Objective-C frameworks that drive OS X and iOS applications. Since the Cocoa libraries are implemented in Objective-C, developers can run Swift code and Objective C code side by side.

The trick here is that this kind of interoperability basically has to work perfectly for Swift to succeed. If it doesn’t, then developers will still need to tinker with Objective-C to make their apps work—and that means keeping up to speed in two languages, not one. Which is not the kind of chore developers tend to take on gladly.

They certainly didn’t the last time something like Swift came along.

The RubyMotion Experiment

According to Gregg Pollack, the founder and CEO of Code School, today’s programmers aren’t usually prepared for the complexity that is Objective-C. “Lots of developers started out learning Java, Ruby, and Python,” he said. “Moving from that to Objective-C is foreign, difficult, and full of ways for you to shoot yourself in the foot.”

Unfortunately, Objective-C was long the only language for building iOS and OS X apps. That’s largely because the Cocoa and Cocoa Touch APIs (see our API explainer) for Mac OS X and iOS are written in Objective-C, which means that developers usually write — For more information read the original article here.    

Leave a Reply

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