How To Port an iOS App to MacOS Using Catalyst
All it requires is a click and five minutes
Coming from an iOS background, I always wanted to build macOS apps.
For some reason, though, I was a little hesitant in taking a deep dive into the OS X and the AppKit framework. The fact that the Mac App Store is relatively small was just one of the reasons.
Fortunately, now thanks to Project Catalyst, we can port iOS- and UIKit-based apps to macOS easily.
The convenience that Catalyst offers in porting apps from one platform to another would encourage and bring developers back to Apple’s ecosystem.
It took me literally just five minutes to port one of my iOS Projects — which we shall see in this article.
Did you know?
Project Catalyst was initially code-named as Marzipan.
- You need Xcode 11
- You need Mac Catalina 10.15
- Go to Project Navigator | General Tab, and just enable the macOS checkbox
- Go to Signing and Capabilities, and enable any permissions (e.g., file read/write) you need to for your use case
- Just build it with Mac set as the target
Under the Hood
What happens when you enable Mac support?
When you enable Mac support, a new bundle identifier for the macOS app is created. The new ID is just a prefix (
maccatalyst) to the older iOS bundle identifier.
Xcode adds two capabilities, namely: hardened runtime and app sandbox.
Moreover, Xcode takes care of updating the
entitlements file with the necessary information from the
One big improvement with Catalyst is a single unified Apple developer certificate across platforms. Say goodbye to separate iOS and macOS certificates.
Our First macOS App Using Catalyst
We’ll be porting our vision-based animal classifier iOS project, which we had covered in a previous article, to our macOS application.
Since our application requires accessing images from the photo library, we need to allow the pictures folder access from the capabilities section.
It’s time to run our macOS application. Below is what we see:
That sums up this article. You can view the source code that works on both Mac and iOS from our Github Repository.