- Presented by Vlas Voloshin at Melbourne CococaHeads, July 12 2018 Twitter: Thanks to our 2018 Gold Sponsor Realestate.com.
- If you're looking to make a great modern Mac app, Marzipan isn't for you. If you're looking for an easier way to share UI code between your AppKit and UIKit apps, Marzipan has nothing for you. If you have a relatively simple iOS app that you think might be useful on a Mac, Marzipan.
- Setting aside the project’s weird, baking product inspired name, ‘Marzipan,’ Apple’s upcoming cross-platform iOS-to-macOS development framework, is a great and long-overdue move by the tech giant that could have far-reaching improvements on its desktop operating system.
ABC News
Apple is reportedly nearing the end of a project to make developing apps for its many devices far easier. Like Google’s Project Fuchsia, the goal is to make it possible to write a single piece of code capable of running apps on mobile or desktop interfaces. The initiative is code-named “Marzipan” and it’s expected to save developers time and incentivize the creation of far more apps, which should then lead to more revenue for Apple.
WWDC 2019: Apple's Marzipan is actually Project Catalyst and means more iPad apps on your Mac. There's even more iOS in your MacOS now. A project known as Marzipan is poised to make it easy for developers to publish software that straddles both Apple's iOS and MacOS. The Mac’s App Store is an offshoot of the storefront used.
Marzipan will be fully functional by 2021, but Apple will begin partially rolling it out in 2019, according to a Wednesday Bloomberg report. The notable Apple reporter Mark Gurman cited anonymous sources familiar with the matter who said that the software tool will be released in three waves.
As early as June of this year, the Cupertino-based company will begin allowing developers to consolidate iOS code for iPads into applications for macOS and vice-a-versa. They’d still need to submit two versions of the app, but they wouldn’t need to rewrite its fundamental code. This initial kit could be announced during Apple’s 2019 Worldwide Developer Conference, which was leaked to be taking place in San Jose, California the week of June 3.
The next step would be to allow Mac apps to be converted into iPhone format (and vice versa). Gurman’s reporting reveals that this aspect of Marzipan is what’s giving Apple engineers the most trouble because of how much smaller iPhone displays are compared to Mac screens.
By 2021, the goal is that Marzipan should be able enable code for a single app that will work on iPhones, iPads, and Macs, no conversion needed. This would effectively merge the iOS and and macOS App Stores into a single software marketplace.
Marzipan will immediately benefit independent developers and large companies that currently need to continuously optimize various versions of the same app. But it could also been seen as another step toward what could be reasonably viewed as a software-first approach by Apple to make up for certain lagging hardware sales.
Apple’s fourth-quarter earnings call affirmed that the golden age for the iPhone has come to an end and it has since shown signs of shifting priorities. It’s widely expected to hone in on its growing services business by launching subscription news and entertainment streaming services this year. Apple takes a cut of many app-related purchases on its platforms, so making it simpler for coders to publish more apps could set off a virtuous cycle. This is a similar tactic that one of Apple’s biggest competitions is also working on.
Google has also been rumored to be developing a unified operating system, titled Fuchsia, which would merge its mobile and desktop platforms. This strategy is fundamentally different from Marzipan’s, because it would create an all-in-one operating system that would merge Android and ChromeOS. Marzipan, on the other hand, would leave iOS and macOS intact while letting them share apps.”
Apple fans have long asked for compatibility between its operating systems. It looks like the company could begin delivering on this capability sooner than expected.
EDIT: July 26, 2019
WWDC 2019 brought us SwiftUI and Catalyst. As such this article is not relevant anymore. Feel free to look at the documentation provided by Apple and have fun with these new tools!
EDIT: January 13, 2019
The approach outlined in this post is now outdated. For easy tinkering with Marzipan I suggest you use the amazing Marzipanify tool by Steve Troughton-Smith.
Introduction
Chikito gotchi mac os. At WWDC 2018 Apple stealthily unveiled a new way of creating macOS apps — a rumored long-running project codenamed Marzipan. This was not an official announcement though, just an introduction of a couple of new apps in macOS 10.14 Mojave — Stocks, News, Home and Voice Memos - that were previously only available on iOS, and there was a quick mention of how future iOS apps could be ported to macOS by Craig Federighi, Apple's senior VP of software engineering.
Marzipan is still very unofficial, very beta and should only officially be released in 2019, but with some effort, we can play with it today!
So without further ado, let's take an iOS app and make it run on macOS!
The app
For this post I prepared a very simple app — that allows you to fetch top stories from Hacker News and present them in a simple
UITableView
. This app is simple as far as functionality is concerned but includes some standard plumbing and networking to see whether common libraries can be used on macOS. The good news is that this is indeed possible and we can use libraries like Alamofire, Swinject and others without any special effort! Just make sure to review the dependencies of the libraries you'd like to use, as they might link to frameworks that are not yet available on macOS.Preparing your macOS
Since this is very new you will need to install beta versions of macOS and Xcode. Specifically you'll need:
- macOS 10.14 Mojave (Beta)
- Xcode 10 (Beta)
Damelin And Marzipan Mac Os Download
![Damelin Damelin](https://cdn.vox-cdn.com/thumbor/lD8bv31GMaEZUgLDuqmU6Pc6VFo=/0x0:1536x960/1200x0/filters:focal(0x0:1536x960):no_upscale()/cdn.vox-cdn.com/uploads/chorus_asset/file/11496101/image_large_2x__1_.jpg)
To make your Marzipan app run, you unfortunately need to disable some security measures running on your macOS. Plant game mac os.
I highly suggest you re-enable these security measures when you're done tinkering with Marzipan or that you play with the framework on your non-primary Mac.
First, you need to disable System Integrity Protection. SIP is a security measure originally introduced in OS X 10.11 El Capitan that simply, restricts what parts of macOS your app can touch. Disabling SIP is required, because as you will see later in this post, your macOS app must use a new entitlement
com.apple.private.iosmac
that is currently internal to macOS.The second thing you need to do is to bypass AppleMobileFileIntegrity Kernel Extension. AMFI is a security measure that instantaneously kills any app that uses restricted entitlements, and
com.apple.private.iosmac
is indeed a restricted entitlement, so AMFI must be disabled.To nuke your Mac's security you need to follow a couple of simple steps:
- Boot your macOS to Recovery mode (hold
⌘+R
) - Open Terminal (you can find it in the Utilities drop-down menu)
- Execute
csrutil disable
in Terminal to disable SIP - Execute
nvram boot-args='amfi_get_out_of_my_way=0x1'
to disable AMFI - Reboot your Mac and boot to macOS normally
Now that we're done reducing macOS security to shreds we can play with Marzipan!
Making an iOS app run on macOS
I have prepared a GitHub repository with an app that runs on both iOS and macOS with exactly the same codebase. You can find it here: https://github.com/jankaltoun/TastyMarzipan.
The caveats
Modifying an iOS app to run on macOS is fairly easy. It mostly involves a target-build configuration. There are, however, a couple of caveats that need to be taken into account.
So far, I have not been able to port an app that uses Storyboards and Nibs. This is because Xcode will refuse to compile iOS Storyboards and Nibs when targeting macOS. From what I heard from the folks lucky enough to visit WWDC this year, some new apps use Storyboards, so this must be possible. Just maybe not with the tools that are available to us right now.
If you know how to use iOS Storyboards/Nibs with Marzipan please let me know. I'd love to figure this out!
My example app defines its UI in the code.
I have run into issues with some UIKit constraints. For example the following code in the NewsCell.swift file builds and works in debug mode but crashes when you run the app outside Xcode.
You need to use a macOS
UIKit
framework that is not easily obtainable. Fortunately there's an awesome example by @biscuitteh available here: https://github.com/biscuitehh/MarzipanPlatter where you can obtain this framework.Modifying and iOS app
Let's describe the steps needed to make your iOS app run on macOS. Hopefully if you follow all of them your'll be able to reproduce my results.
Start with a new Target
Open your Xcode project and add a new target. In Build Settings update your
Base SDK
and Supported Platforms
entries.- Base SDK: macOS
- Supported Platforms: macOS
Your code signing will most likely be messed up in the General tab so you'll need to fix it. As a simple test, unchecking and rechecking
Automatically manage signing
should be enough.You will also need to modify the auto-generated Plist file to match a macOS app. Feel free to grab a copy from my example project.
Finally, you will need to update your Podfile with your new target and platform. In the end, it will look something like this:
Link to macOS UIKit
As mentioned above your app won't compile without the macOS UIKit. Grab a copy from here https://github.com/biscuitehh/MarzipanPlatter/tree/master/Frameworks and copy it to a directory within your project.
Now back in Build Settings update
Runpath Search Paths
parameter to point to your frameworks directory.In the Build Phases tab, add your UIKit framework in the Link Binary With Libraries section.
Add forbidden entitlements
We have already nuked our macOS security so let's add a couple of entitlements to make the app work.
Create a new .entitlements file and add the following code to it.
![Download Download](https://pspdfkit.com/assets/images/blog/2018/marzipan-iosmac/mojave-vm-cdd55ad8.png)
Do not forget to update your Build Settings so that your settings know about this file.
Add a magical environment variable
To be very honest I am not very sure why this works but an environment variable
CFMZEnabled=1
must be used whenever you run the macOS app otherwise it will crash on weird assertions and UILabel
s will behave weirdly.Add it to your scheme and don't forget to use it when you ran the release build as well (more about this shortly).
Build and run your macOS app!
This should be it! Select the scheme that was created for you by Xcode when you added the macOS target, hit the
⌘+R
and behold! Your macOS app is running.To export and run your new app firstly archive it:
xcodebuild archive -workspace 'YourApp.xcworkspace' -scheme YourAppMacScheme -archivePath ./build/YourApp.xcarchive
Then export the archive:
xcodebuild -exportArchive -archivePath ./build/YourApp.xcarchive -exportOptionsPlist ExportOptions.plist -exportPath ./build/
Your ExportOptions.plist file might look like this:
And finally run the app with a magical environment variable:
CFMZEnabled=1 ./build/YourApp.app/Contents/MacOS/YourAppMacScheme
That's it!
As you can see converting your iOS app to a macOS app is not that complicated — we made it just by following a couple of fairly easy steps.
When Marzipan finally comes in 2019 I am sure many of the issues mentioned in this article will be resolved and I feel that creating macOS apps will be incredibly easy for iOS developers.
Damelin And Marzipan Mac Os X
I'd say let's prepare for an App Store explosion, as we'll see many new macOS apps made possible by Marzipan.
Damelin And Marzipan Mac Os Update
2019 will be a good year.