Among all the underwhelming announcements of new features for its operating systems at the WWDC keynote, Apple did have something interesting to share with developers wondering about building apps for macOS and iOS.
We previously heard rumors about the company merging its mobile and desktop platform in what was allegedly codenamed Project Marzipan; Apple’s SVP for software engineering, Craig Federighi, debunked the claim on stage, saying:
John Gruber, who blogs about Apple at Daring Fireball, wrote last month that there wasn’t going to be a merge, but rather an API that would make porting apps between platforms easier. Federighi confirmed that, saying there’s likely plenty of interest in porting iOS apps to macOS, and that Apple’s been working on a way to simplify that process – all while maintaining two separate OSes to serve different use cases and device form factors.
Wired noted that the company’s been working on porting tools for the past two years, and that these will become available to developers in 2019. You can see the results in the new News, Stocks, Voice Memos, and Home apps for macOS Mojave, which Federighi said were ported over from iOS with “very few code changes.”
For developers, the porting process will deeply involve UIKit, which will soon support macOS as a target platform. When you begin building a desktop version of your iOS app in Xcode, certain aspects will translated automatically. For example, if an interaction on mobile requires a long press, the app’s desktop counterpart will accept a two-finger mouse or trackpad click instead.
Other parts of your desktop app may require some custom code; Wired cited examples like making a Mac app sidebar translucent, and incorporating share buttons into the program’s toolbar.
It’ll be interesting to see how developers take to this once the porting tools become available next year. I imagine that many apps for productivity, as well as for creating, browsing and sharing content (like Reddit or Instagram) will see the release of mobile and desktop versions for the Apple ecosystem – with less work to maintain them.