I always wanted to build macOS apps but couldn’t give much time to the AppKit, NSTableViews, and stuff.
Fortunately now thanks to Project Catalyst, we can port iOS and UIKit based apps to macOS easily.
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 codenamed as Marzipan.
- You need Xcode 11
- You need Mac Catalina 10.15
- Go to Project Navigator | General Tab and just enable the macOS checkbox.
- Goto Signing And Capabilities And enable any permissions (file read/write) you need to for your use case.
- Just Build The Project 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 just prefixes
maccatalyst to the iOS Bundle Id.
Xcode adds two capabilities, namely: Hardened Runtime and App Sandbox.
Moreover, Xcode takes care of updating entitlements file with the necessary info from the info.plist
One big improvement with Catalyst is a single Unified Apple Developer Certificate across platforms.
Say NO to separate iOS and macOS certificates.
Our First MacOS App Using Catalyst
We’ll be porting our Vision based Animal Classifier iOS app to macOS.
Since our application requires accessing Images from the photos library, we need to allow 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.