Code

Mac Catalyst: how to make an app available on iPhone, iPad and Mac!

Back to the blog

With the new Macs with Apple Silicon processors (Apple M1), it is possible to make your iOS or iPadOS app directly available on the Mac App Store, without any additional development. The only drawback is that you end up with the look and feel of an iOS app on your macOS app.


To be available on any Mac and better integrate with their OS, Apple has served us Mac Catalyst. Presented to developers at WWDC 2019, this technology allows you to port an iOS app natively to macOS.

Technically, how does it work?

Otherwise called "UIKit for Mac", Mac Catalyst invites mobile developers to create a Mac application very easily via UIKit, the framework for creating interfaces on iOS, instead of AppKit, its macOS counterpart. The code will be identical, the compilation result different, optimized for macOS. Visually, the app will use the graphical components present on macOS and it will be possible to interact with the keyboard and mouse directly.

To make such a port possible, Apple has completed the unification of its various low-level frameworks (Foundation, CoreLocation, UserNotifications, ...) between all its platforms. An iOS app and a macOS app are based on a common base, on which the interface is placed, where the UI frameworks are different from each other, each one meeting the needs of their platform.

Mac-Catalyst-application.png

Some AppKit APIs are also available, such as NSTouchBar to configure the TouchBar of recent MacBook Pro models. On the other hand, some APIs are not available for Mac Catalyst, for example those using the gyroscope or the accelerometer.

What are the advantages of Mac Catalyst?

Mac Catalyst impresses by adapting visual elements (controls, menus, alerts) according to the platform on which the application is distributed. This allows native rendering on macOS, as if it had been developed with AppKit.

Sharing the same source code is a nice promise, and even if we will have to adapt to the platform in some places, most of the code is shared. Adding new features or maintaining and improving existing ones will be faster and therefore less expensive.

The iOS developer community being much larger than macOS, Mac Catalyst allows us to take the step and have a Mac application without too much experience on macOS. On the users' side, this will help to expand the range of applications available on the Mac App Store, which is currently rather limited.

One restriction to note is the performance limit that we noticed on large screens with high resolution, where animations that run natively at 60fps are stuck at 30fps.

A concrete example with our Splash° app

The idea of Mac Catalyst is rather to be able to quickly and easily make apps compatible from iPadOS to macOS than from iOS to macOS, because of their design adapted to larger screens. Splash was only available on iOS, so in order to make the app available on iPadOS and macOS, we had to redesign it.

We switched to a display with two views side by side, to optimize the use of the available space, via a list/detail pattern. It is important to test on various screen sizes, in some cases, on iPadOS, the screen is too small and the iPhone interface is displayed instead of the iPad one.

Even if the code base is identical, there are some differences that should be tested, especially the geolocation management, which is less advanced on macOS.

In addition, it's a good idea to add menu entries, as well as shortcuts for useful actions, which are very popular on the Mac, but much less present on mobile devices.

When deploying the app, it's a shame to note that Testflight is not yet available (support for macOS has been announced for fall 2021), so sharing beta versions is more tedious than on iOS.

Because an image is worth a thousand words, before, during and after...

Screenshot 2021-09-17 at 15.11.09.png
Screenshot 2021-09-17 at 15.03.25.png
Simulator Screen Shot - iPad Pro (11-inch) (3rd generation) - 2021-09-17 at 14.56.21.png
Simulator Screen Shot - iPhone 12 - 2021-09-17 at 14.55.00.png

How is Catalyst a real game changer?

Making an application available on three types of devices, iPhone, iPad and Mac can seem complex, the screens are not the same size, the users do not have the same expectations depending on whether they are on mobile or desktop.

However, Catalyst offers a real advantage, you don't need to develop an iPhone app separately from your web app. By having one application that is compatible with all three types of devices, you save on development time, which will also reduce your budget!

If your users or customers need to use your product on iPhone, iPad and Mac, Mac Catalyst can meet your needs, without having to develop your app twice. Enhancements and updates will also be easier as you only have to modify one source code.

Author

Published on the 13 September 2021

Software Developer