Open source Chameleon project aims to ease porting iOS apps to Mac

Plenty of developers have ported their iOS apps to the Mac, but have run into …

Ever since the launch of the App Store in 2008, developers have been looking for ways to bring some of the cool features they implemented for the iPhone back to the Mac. Then, with the 2010 launch of the Mac App Store, a whole new group of developers began looking for ways to port their iOS apps to the Mac for the first time. Now, two prolific developers have teamed up to create Chameleon, an open source project that aims to make it simpler to bring iOS work over to the Mac.

Pull back the curtain on the Chameleon Project and you'll find developers Sean Heber and Craig Hockenberry, both of Iconfactory fame. The two say their motivation for creating Chameleon was the latest version of Twitterrific for the Mac, which ended up bringing over many of the popular features from Twitterrific for iOS. According to the project page, Iconfactory faced only being able to use 25 percent of its code from the iOS version on the Mac, but was able to turn that into 90 percent after porting the iOS UIKit into a new framework on the Mac. That new framework is Chameleon.

Heber and Hockenberry point out that there are a number of difficulties in porting UIKit as-is to a desktop environment, such as handling multitouch events and scrolling inconsistencies. "Chameleon is not a panacea: although it's possible to just recompile your iOS app and have it magically work on Mac, it's not recommended," Hockenberry told Ars. "Apple wants apps in the store to look and behave like they belong on the Mac."

These things may simply never get addressed by Apple as it continues to put heavy emphasis on iOS, so the team got to work for nine months to build a suitable substitute. In fact, Chameleon is being referred to as a drop-in replacement for UIKit, and in many cases, that's all that needs to be changed in order for an iOS app to run on the Mac. And, there's apparently no shady code involved, or anything that would get you in hot water with Apple. "This new framework is a clean room implementation of the work done by Apple for iOS. The code is based on Apple's documentation and does not use any private APIs or other techniques disallowed by the Mac App Store," reads the Chameleon site.

But why would someone create something like Chameleon when Apple might very well address some of the same concerns with UIKit sometime in the future? "The talented engineers at Apple are certainly capable of overcoming these hurdles, but it's clear that their focus these days is on the future. And the next 30 years belong to iOS, not Mac OS X," the team wrote. (Though a number of iOS and Mac developers told Ars last summer that they see iOS eventually absorbing Mac OS X, that's not likely to happen anytime in the very near future.)

What Apple says still goes

Despite this, Heber and Hockenberry acknowledge that things within Apple could change, and the Chameleon developers would be OK with that. "Of course, Apple executives may change their priorities when they see how many developers are interested in a tool like Chameleon. Many people have speculated that the popularity of the Jailbreak SDK accelerated the release of the original iPhone SDK. It would be great if history repeated itself.

What won't be coming to the Chameleon framework is Android or Windows Phone 7 support, because of its reliance on Apple's proprietary Core Animation technology. And, if Apple decides it's not cool with a third-party knockoff of its own intellectual property, the team has no qualms with taking it down, as they're not in it to make money. Although the team accepts donations to support the project (there's a $250 T-shirt for sale, as well as a T-Shirt and stock icon bundle for $500), it's clear that the two developers' primary motivation is simply to help other developers in the iOS and Mac community to do better work, and faster.

"We're hoping the expensive T-shirts raise funds that we can use to pay for our time contributing and managing the project," Hockenberry told Ars. "We thought about licensing this code to other developers, but decided against it. The project will benefit from open collaboration and we didn't like the idea of charging developers to use code invented by Apple."

Still, the project is still in its early days, and Hockenberry emphasized the need for more developers to help flesh out the framework. "The project is in serious need of documentation: both in the code, so developers can learn how things work, and with a porting guide that helps them adapt an iOS app to the Mac environment," he said. "Many developers are excited about what we've released because they see a new market for their product. And with some time and effort, a great app on iOS can become a great app on the Mac, too."