At WWDC 2019, Apple announced its project Project Catalyst (also known as Marzipan). It is created to let developers release iOS apps for macOS, starting with the upcoming major update macOS Catalina.
Last year, Apple ported some iOS apps to macOS via the Project Catalyst (Apple News, Voice Memos, Stocks and Home). This year, Screen Time is coming to macOS together with some new iOS 13 features, such as new Reminders app, photo gallery, and folders in Notes. At the same time, some big companies like Twitter, Gameloft, Atlassian, and DC, announced they will also bring their applications to macOS.
As previously reported, Project Catalyst allows developers to easily port their iPad apps over to macOS. By default, the macOS version of an iPad app supports window resizing and full-screen display; mouse, trackpad, and keyboard input; copy/paste, and drag and drop; touch bar controls; a default menu bar, and Mac style scroll bars. However, developers can do a little bit of extra work to make their apps fit better on macOS with things like toolbar shortcuts, menu bar controls, and translucent sidebars.
To start porting an iPad to macOS, developers should install XCode 11 beta first, then open the Xcode project and select the iOS target they want to configure. After that, they have to go to General tab > Deployment Info, and click the checkbox for the Mac device (in case your app supports iPhone only, the checkbox is unavailable).
Once you select the Mac as a supported device, Xcode will make the following changes to your project:
- Add a bundle identifier for the Mac version of the application
- Add the App Sandbox Entitlement (a Boolean value that indicates whether the app may use access control technology) to your project
- Add My Mac to the list of destinations that can be chosen when running your app from Xcode
- Excludes incompatible frameworks, app extensions, and other embedded content
Despite the fact that Xcode excludes incompatible frameworks and embedded content where possible, sometimes it is necessary for developers to exclude some content manually. To do so, go to the General tab for the iOS target > Frameworks > Libraries > Embedded Content. After that, select iOS as the platform setting for the item. This setting excludes the item from the Mac version of your application.
For projects which contain code which no longer compiles because of frameworks or APIs that are unavailable to the Mac, it’s possible to be enclosed as shown below:
#if !targetEnvironment(UIKitForMac)
// Code to exclude from Mac.
#endif
You can also use the same approach to include a framework which is available only in macOS.
#if targetEnvironment(UIKitForMac)
// Code to execute only on Mac.
#endif
Additional information on Project Catalyst can be found at the Apple developer website.
Photo Credits: Twitter
Please, have in mind that SpyHunter offers a free 15-day Trial version with full functionality. Credit card is required, no charge upfront.