How To Make An iOS App Run On Windows 812:00 PM EST Thu. Jan. 31, 2013
If you know how to create an iPhone app, you're half way to building one for Windows 8. According to developer and consultant Aaron Hillegass, apps now offered through Apple's App Store don't have far to go before they can also reach the shelves of Microsoft's Windows 8 Store. "As soon as you have a successful iOS app, much of the work is done," said Hillegass, who's been programming since age 10 and got his first programming job at 19. "There are parallels between the two platforms and some things can be reused. You're not starting from zero."
A code re-write here, an API map there and in no time your apps should be riding on the Metro.
Why should you care? For one thing, Microsoft's revenue share is larger for successful apps than Apple's. After the first $25K, the revenue split for Windows 8 apps switches to 80/20 from its starting point of 70/30 (same as Apple's, which is fixed). And with 700 million Windows 7 license holders out there, many of which in theory will upgrade to Win8 eventually, the potential audience is huge while the competition is relatively small, with only 10,000 Win8 apps currently being offered.
"Angry Birds came out about a year after iPhone SDK," said Hillegass, who characterizes the hugely popular app as mediocre. "It's an OK game; it's not incredible. But, they've created an incredible franchise that makes $60 million a year in profits." There's even a TV show. "With the Windows 8 platform, there's a huge opportunity to create a franchise," he said, calling it 2009 all over again. "There's a business case." What's more, Microsoft allows developers to offer free-to-try apps that time out if not purchased. Apple does not; apps have to cost at least $0.99. Still not sold on porting? Read on.
The benefits of running apps natively on Windows 8 really pick up if your customers happen to be in the enterprise. "One thing that's neat is to run the app on a virtual server in a data center and access it on a tablet for a mobile workforce. This is a huge step forward because it's hard to use an app with touch that wasn't designed to use touch," said Hillegass, referring to pre-Win8 apps. "Microsoft has given us a way to create touch-friendly apps that can run in the data center but be accessed from tablets in the field."
Of course, iPad also can access server-side or cloud-based apps using Citrix Receiver or similar remote control methods. But, such solutions still involve accessing non-touch apps from a touch device. "Tools like that don't make a lot of sense for the enterprise. Win 8 apps can run on a server and still be touch-friendly," he said. "When you write the app for touch, they are more natural to use with touch." Discover similarities between iOS and Win8 Metro next.
The chart shows all of the APIs of the Windows 8 Runtime. Blue boxes are those for which there is not an analogous API for iOS. As iOS developers surely know, Apple platforms lack NFC, "Live Tiles," direct links to SMS and other things. When in doubt about how iOS APIs map to those of Win8, Hillegass refers developers to an online map of iOS-to-WinRT functions.
Also significant, C# is more strongly typed than Objective C. "Being loosely typed lets you do some powerful things with very few lines of code," said Hillegass. "For example, creating an object from a file, [as with] a persistence layer, tends to be elegant." Having iOS core data services simplifies object storage in SQL. Implementing persistence on the Windows side requires lots of extra code. With weakly typed languages, there's less error checking by the compiler. "On iOS, you have to be more diligent about testing. Because [C#] is strongly typed, the compiler can catch more errors at compile time, which creates less buggy code and lets you find your bugs more quickly," he said.
"Microsoft has worked hard to optimize the experience for tablet users, who usually consume, not create," said Hillegass, adding that Win8 real estate is maximized for content. "You want to use all the pixels for content, not for chrome," so commands are hidden until there's a swipe. Swiping in from top and bottom invokes app-specific functionality; left and right swipes switch apps or bring up the Charm bar. To be clear, all client-side Objective C code has to be re-written for Win8.
Then there are the things that just won't translate, and one of them is design. While Apple has encouraged developers to make apps look skeuomorphic (like things in the real world), Microsoft wants Win8 apps to look "authentically digital." Each has built its design tools accordingly. With Microsoft, "there's more emphasis on having type to describe things instead of using icons, and there are not as many reflections or shadows," Hillegass said, who correctly points out that it's fairly useless to use an icon of a 1990s-era floppy disk to represent the Save function. "It's easier to have a 'Save' button, but you'll have to localize it."
On the Apple side, a book shelf will look like it's made of oiled mahogany, and "a notepad looks like a notepad," he said. Also, Windows 8 offers no version of Bonjour, and Microsoft doesn't allow Windows 8 Store apps to use OpenGL; only DirectX is permitted. Hillegass, who founded training and development consultancy Big Nerd Ranch, has written numerous books on Apple programming, including the seminal Cocoa Programming for Mac OS X.