Monday, March 4, 2019

Bringing iOS Apps to macOS Using Marzipanify

Steve Troughton-Smith:

At WWDC 2018 Apple gave us a ‘sneak peek’ at perhaps one of the most impactful developments on macOS since the transition to Mac OS X: UIKit apps running on the desktop. Today, I’m going to detail a special tool I built, called marzipanify, to get started with UIKit on the Mac early, and start the initial bringup of your iOS app on macOS.


There’s another reason for the iosmac distinction: many of the frameworks underneath, née iOS Simulator, clash horrendously with the built-in macOS frameworks, thanks to a decade of divergence from OS X. Both iOS and macOS today share a UIFoundation framework to help support UIKit and AppKit and provide common code, but UIFoundation makes decisions at runtime based on which platform it’s running on that affect everything from Interface Builder to text rendering. At its simplest level, this means that if you link AppKit into your iOSMac app, all manner of things will explode in your app. The iosmac linker variant for iOSMac binaries explicitly prevents loading non-iosmac binaries and libraries into your code (unless they’re whitelisted).


Altogether, it appears running modern UIKit on macOS is so much more complex than the more-obvious tack Chameleon took when it rewrote UIKit for the Mac all those years ago. It’s not a virtual machine by any stretch, despite evolving from the iOS Simulator, but it certainly goes to great lengths to distance itself from how Mac apps traditionally work.

Steve Troughton-Smith:

If you look at your newly-marzipanified app, and compare it with Apple’s built-in UIKit apps on Mojave, you will notice that yours looks a lot more clunky and less-native than what Apple’s doing. To really make your app sing, you’re going to have to use some new classes and mechanics unique to UIKit on macOS.


One thing that is key to remember is that Marzipan scales everything in your window by 0.77 to better suit the desktop. This is mostly transparent to the developer, unless of course you’re trying to closely match the metrics used in AppKit apps for e.g. sidebar row height, and you suddenly realize everything is smaller than it should be.


You may find all your centered text is no longer centered when run on the Mac. That’s because Apple uses different integer values for the NSTextAlignment enum, so NSTextAlignmentCentered is interpreted as NSTextAlignmentRight.

James Thomson:

Here’s iOS PCalc running under Marzipan on Mojave. Mostly working, with a few graphical glitches - some stuff works even better than the current Mac version, like fullscreen / live resizing. Looking forward to seeing what we get officially at WWDC in June.

Previously: Apple to Target Combining iPhone, iPad, and Mac Apps by 2021.

4 Comments RSS · Twitter

Gross. Who wants this? Why is this better for the Mac user? What is the point of this effort?

Personally everyone I know that uses a Mac or loves the Mac is a serious computer user, specifically choosing the Mac over other options for a reason - not coincidentally that is why the current Mac line, MacBook Pro especially, is so poorly received, it's not serving pro user needs! If these people thought the iPad was going to meet their needs, they would have chosen an iPad. I have never heard any Mac user wish they had iPad apps, aside from a handful of extra loud technosadists on Twitter who hate the Mac so much they're drooling with enthusiasm about the idea of bludgeoning the Mac into nonexistence.

I don't get it, I must be missing something. I'm always interested to see what WWDC brings, but I am more worried than anything else this time around.

A sneak peak of the death of the Mac! ;(

It will certainly be interesting. I think Apple's hype is totally overblown (as usual) when it comes to the iOS App Store. Sure, there are millions of apps but to me it seems like, what, 95% of them totally suck? And a bunch of the good ones won't work on a Mac because they depend on i-Device hardware that the Mac doesn't have (and doesn't have a reason, like a gyroscope/accelerometer) or are simply the type of app that there's no good reason to use on a Mac (like apps that rely on direct touch input where a mouse can't substitute). And other apps, like Fantastical, I don't want to be "dumbed down" to their iOS counterparts -- the Mac version is great as-is. I don't want a copy of the iPad version of it on my Mac screen.

So I'm not so sure how great the benefit will really be. Sure, with thoughtful developers like Marco Arment we will surely get a kick-ass Mac-compatible version of Overcast which he wouldn't otherwise have the time to write and maintain (without Marzipan). That will be cool. But I think many other developers will do the bare minimum (or won't even bother at all) to make their apps "Mac compatible" so they can use it as a selling point — possibly to charge more money.

I mean... look at the poor quality of iOS apps *today*. So many of them suck, even ones from big companies that have the resources to hold themselves to a higher standard (Google, Pandora, Spotify, Bank of America apps are all awful, to use an example). If those guys can't design apps that are user-friendly and follow Apple's design guidelines... well, now we're going to have that garbage on the Mac too. Get ready.

[…] Bringing iOS Apps to macOS Using Marzipanify […]

Leave a Comment