Skip to main content

Marzipan in Mojave: Porting developer iOS apps to macOS

With macOS Mojave, Apple introduced four apps that were previously only available on iOS: Stocks, News, Home and Voice Memos. During the presentation, speculation began on how these could be the iOS apps themselves, ported to the Mac with the rumored Marzipan project. At the end of the Keynote, Craig Federighi presented a sneak peek at a multi-phase project they’ve been working on. Without giving it any name, Craig explained that this project allows iOS apps to be ported to the Mac with minimal effort,that Apple used this for their News, Stocks and Voice Memos apps and that it would become available to third-party developers next year. I decided to explore this project and see just how minimal an effort it would be to port an existing, real-world iOS app to the Mac.

The name

First of all, I’ve been able to confirm that this project is (or was at some point) in fact called Marzipan internally. We shouldn’t expect anyone at Apple to ever say this name publicly though. These iOS apps on the Mac are currently known by the system as “iOSMac” apps. Very creative.

User experience

Moving apps from a platform that’s based on touch input to a platform that’s based on a mouse and keyboard has some usability implications. At least in the current state of the project, it looks like Apple decided not to adapt the look of the apps too much, so they look a lot like the iOS versions, especially the Home app.

Apps that are tab-based get an adaptation: the iOS tab bar disappears and is replaced by a native Mac toolbar with a segmented control. Another control that’s translated automatically is the share sheet. When calling for a share sheet to be opened, the iOS app running on macOS will show the standard Mac sharing menu.

User interface elements that have long-press or 3D-touch gestures for activation on iOS get those gestures replaced by a double-click, this can be seen in the Home app: on iOS, you 3D-touch or long-press one of the devices on the grid to open the details view, while on the Mac you double-click to get the same effect.

Other Mac-like elements that can be used by iOS apps on macOS are contextual menus, the menu bar, translucent sidebars (such as the one in the News app), window toolbars and the Touch Bar. These elements have been exposed to the iOS apps through new classes in the version of UIKit available on the Mac.

There are some things about iOS apps running on the Mac that feel out of place at the moment. First of all, UIKit apps on macOS can’t have more than one Mac window, so multi-window apps are not currently possible. If the iOS app tries to open up a new window, it just replaces the contents on the main, single window it has access to on the Mac.

Other iOS UI elements look weird on the Mac, such as form sheets and alerts, which sometimes open up the standard Mac alert sheet, but not always.

This is still the first beta and all of the issues and missing features mentioned above can be addressed, I expect the iOS app experience on the Mac to improve significantly before September and until Apple decides it’s ready for third-party developers to adopt.

Developer Experience

I decided to try out two experiments to see just how minimal an effort it would be to port an iOS app to the Mac: porting the 9to5Mac app and my own ChibiStudio app.

“9to5marzipan”

This was an interesting project because I’m not familiar with the codebase since the 9to5Mac app is developed by Benjamin Mayo. He sent me an archive of the code and the first step was to remove all dependencies (third-party frameworks). It’s not that you can’t have dependencies on your iOS app if you want to port it to the Mac, but I wanted the build process to be as simple as possible since Apple is not distributing an official SDK yet.

Getting the app to run on the Mac took me about an hour of work, most of which was spent dealing with the removal of dependencies, converting it to Swift 4.2 and dealing with issues caused by the hacky build process. The resulting app works very well on the Mac, you can browse articles and read them just like on iPad. With some more work, I could probably make it more Mac-like, maybe with a translucent sidebar for the articles list like Apple did with the News app.

ChibiStudio

My app uses CoreAnimation very heavily, so I was curious to see how it would work on the Mac. The Mac has CoreAnimation, but there are some differences between that and its iOS counterpart. Again, most of the time was spent dealing with dependencies and “flattening” the app so it would build in only one target (the original app is divided into multiple frameworks). ChibiStudio also has an iMessage app (which is not supported on macOS), so I removed that.

Porting it took me around 2 hours and I was surprised at the results. Most of that time was spent dealing with the removal of the dependencies and converting the code to Swift 4.2. The resulting app works surprisingly well on the Mac, including drag and drop for items in the canvas and the selection of items, which is actually better on the Mac because of the precision you get from the mouse pointer.

I decided to go a step further and remove the iOS navigation bars from the app, replacing their components by buttons in the Mac toolbar. I also added menu items for common actions, so it’s possible to press N to start a new chibi. One thing that did not work was dragging a chibi from the library to Finder, I’m not sure if that’s an issue with my implementation or a limitation of the system.

Other apps

Other developers are already experimenting with porting their own apps to the Mac. Joshua May from Geekbench ported the Geekbench and VoodooPad apps to the Mac. Probably the most impressive port so far was Peter Steinberger’s port of the PDF Viewer app, which has a million lines of code and took half a day to port, according to him.

The future

This is just the beginning of iOS apps running on the Mac and it’s already looking like Apple came up with a good strategy. Should we expect Mac apps that are currently running cross-platform solutions, such as Slack, to bring their iOS apps to the Mac? I’d say not in the short-term. What I’m looking forward to most are media-consumption apps such as Netflix and YouTube bringing their apps to the Mac, which I believe will provide a better experience than what we get in the browser.

Which iOS apps would you like to have on the Mac? Let us know in the comments!


Check out 9to5Mac on YouTube for more Apple news:

FTC: We use income earning auto affiliate links. More.

You’re reading 9to5Mac — experts who break news about Apple and its surrounding ecosystem, day after day. Be sure to check out our homepage for all the latest news, and follow 9to5Mac on Twitter, Facebook, and LinkedIn to stay in the loop. Don’t know where to start? Check out our exclusive stories, reviews, how-tos, and subscribe to our YouTube channel