Using Catalyst, it is finally possible to bring your existing iPad apps to the Mac. When making your app available on macOS, you can target a new platform with more than 100 million active installs.
IBM made the huge misstep of allowing win32 apps to run on OS/2. Developers largely abandoned the platform and focused on windows. Granted there were other factors to the demise of OS/2 and IBM's inability in many areas doomed the OS. App to open avchd files on mac. The point however is that developers did not embrace OS/2 since their windows apps ran.
- Catalyst is an awesome way to build apps for the Mac. If you already maintain an iPad app, you can bring your app to the Mac with very less effort. Apple also provides APIs to make your app integrate better with macOS, by adding support for the menu bar, touch bar and other macOS specific functionalities.
- MacOS Catalina includes a new Mac Catalyst feature that's designed to make it simple for developers to bring their apps created for the iPad over to the Mac App Store. Several developers have.
- Although Catalyst does a good job of making UIKit work on macOS, you will quickly realize that some things that worked great on iOS just aren’t great fits for macOS. So, if you want to detect when your iOS app is running on macOS using Catalyst, you can add an #if targetEnvironment check to provide alternative functionality, like this.
- In a very basic sense, these are cross-platform apps, as Catalyst handles much of the tooling (such as keyboard support and window-sizing) that makes desktop apps shine. As we’ve pointed out, this is equally amazing and frustrating. Apple made the tooling available to iPad and Mac, but left iPhone and Apple Watch in the lurch.
The reason iPad apps can now run on the Mac is that Apple added support for UIKit in macOS Catalina. UIKit is the framework that allows you to style your app using a rich set of UI elements. In the past, macOS apps could only be build using AppKit, another UI framework. Now macOS is supporting UIKit, developers can really easy bring their apps to the Mac App Store.
Not all apps are useful on macOS, like navigation apps. Also, apps that use augmented reality are not useful on macOS, because the technique is not available on Macs. For this reason, Apple didn’t bring the ARKit framework for Mac.
Build your iPad app for macOS
Apple made it easy for developers to run existing iPad apps on the Mac. To start, open your project in Xcode 11 and go to the settings of your app. Then, on the “General” tab, you will find the new option “Mac” as deployment target. Just enable the checkbox and you’re ready to run your app on macOS!
When clicking the deployment checkbox “Mac”, Apple will arrange some processes for you:
- Adds a bundle identifier for the Mac version of your app.
- Adds the App Sandbox Entitlement to your project.
- Xcode includes this entitlement in the Mac version of your app, but not in the iOS version. Adds My Mac to the list of destinations that you can choose when running your app from Xcode.
- Excludes incompatible frameworks, app extensions, and other embedded content.
To submit an app for macOS, you need to create a new app in the App Store Connect portal. This is because macOS apps have a different bundle identifier.
Third-party frameworks
Catalyst works great with Apple frameworks and a lot of third-party frameworks. Some of the third-party frameworks won’t compile, like Firebase. Because of this, you may need to disable some frameworks or uncomment some code.
Frameworks like Crashlytics and Firebase are not running. They need an iOS simulator for compiling code. Simply uncomment this part of code and disable the frameworks for your macOS build.
Another issue that can happen, is that some frameworks are also available for macOS, like Kingfisher. SDKs can contain #if canImport(Appkit) code. Xcode will compile this code, because AppKit is available for the macOS target. Simply uncomment this part of code to let your app compile.
Disable functionalities for macOS
There may be functionalities in your app that are excellent for iOS or iPadOS but are useless on macOS. It is easy to disable this code for macOS using a target environment check.
Example to exclude functionalities for macOS:
Using the code above, it’s possible to exclude code for macOS. If you want to add functionalities only for your macOS app, you can use the same check, but then without the exclamation mark.
Example to add functionalities for macOS:
Add support for the macOS menu bar
Bringing your iPad app to macOS makes your app already look and feel like a macOS app, but there are some improvements you can add to integrate better with the macOS operating system. One of the core functionalities that can be added, is support for the menu bar.
At WWDC, Apple announced UIKeyCommand, which enables support for menu bar. However, UIKeyCommand is already deprecated for now. When Apple did make a final decision about how developers can add support for the menu bar, I will update this article.
Add support for drag and drop
One of the main functionalities for computers is dragging and dropping content. Supporting this in your macOS apps is easy, by integrating the UIDragInteraction and UIDropInteraction instances.
Drag and drop was announced during WWDC 2017 and is available for iOS 11 or higher. If you already added support for drag and drop in the past, your macOS app will automatically support drag and drop!
To get an introduction to drag and drop, I recommend to watch the WWDC session of 2017, Introducing Drag and Drop. This talk by Apple will bring you quickly up to speed with the drag and drop API.
App icon
By default, the app icon you’re using for your iPadOS app, will be used for your macOS app. However, app icons for macOS look slightly different. For this reason, you can set a specific app icon for macOS by enabling the Mac checkbox at your AppIcon in the Assets folder.
Conclusion
Catalyst is an awesome way to build apps for the Mac. If you already maintain an iPad app, you can bring your app to the Mac with very less effort.
Apple also provides APIs to make your app integrate better with macOS, by adding support for the menu bar, touch bar and other macOS specific functionalities. By adding support for those functionalities, users will love your Mac apps!
For more information about Catalyst, I recommend you to read the Catalyst Complete Book, written by Benedikt Terhechte. Also watch the session “Taking iPad Apps for Mac to the Next Level” from WWDC 2019, to get an overview of all the possible integrations with macOS functionalities.
? Like this article? Follow me on Twitter for more macOS related news!
With Mac Catalyst and SwiftUI support for macOS, Apple has been pushing new tools to the community for the past couple years to create new services on Mac computers. Does it mean you should do too? Here are couple things to consider first.
During WWDC 2019, Apple released Mac Catalyst for developers to turn their iPad version compatible with Mac. The same year, SwiftUI was released and introduced a whole new world of possibilities.
I don’t think it’s random that Apple pushed so many new tools to help build apps for Mac. After all, its App Store is a multi billion dollar business. Wouldn’t it be great to consolidate its macOS version by attracting the developer community with great tools? That might just work.
So back to us. Assuming we have an existing mobile app, should we consider creating a macOS version to get to this potentially new users?
As usual, I think it depends. Let’s see what to consider before rushing anything.
User Experience
First thing to consider is the User Experience. By creating a macOS app, do we enhance anything in the existing service? Do we actually take advantage of using a native device rather than a web platform?
I believe it’s important to create an app that feels home on Mac. Like any other software on Apple device, users are used to a “first class” experience, so it’s important to move towards the same goal.
MovieSwiftUI has been a reference since the early days of SwiftUI of how to successfully develop a multi-platform app.
Nobody wants a half baked app that takes too much memory or that hardly resize its window, poorly handled shortcuts or Mac behaviors like the classic drag & drop.
If you already have a website that already does it all and you can’t see a real improvement in the User Experience, then maybe it’s not the best fit to start this adventure.
If, on the other hand, you feel that having access to a powerful computer can really make a difference to your app, like a picture/video editing tool, then go for it! Netflix would be another great candidate for a native macOS app.
Development Cost
Shared code across platforms doesn’t mean new platform comes at no cost.
“Great, we can reuse code all our code, right?”.
Definitely not.
Mac Os Catalyst
If your project wasn’t optimized and designed for it, it’s hard work to get it ready for multi-platform. And once you are there and release a macOS version, remember it’s as much work you’ll need to support and maintain over time.
Some businesses removed their support to iPad for the same reasons: they didn’t have the capacity to support it in the long term and the effort for it was higher than the reward. Creating a poor tablet experience causes frustration to their developers as well their customers. It turns out to be a lose lose situation.
So if you choose to move forward, make sure you can go the distance.
App Usage
If it’s common for iOS users to browse the App Store and install / uninstall apps, I believe the same behavior is not true for Mac.
You can ask yourself the same question. Do you remember when was the last time you installed an app on your iPhone? How about your laptop? For me, it has easily been weeks or months.
If you managed to get your user installing your macOS app, chances are it will be for a long time. I don’t think many users clear their programs on weekly or monthly basis.
Mac Os Catalina Ipad Apps
In short, mac users could be there for the long term (or longer than iOS one), so let’s make their first experience the best one.
RedditOS has been a great alternative to Reddit website.
New Market
Finally, before rushing into the design and development of a macOS app, it might be interesting to look into platform usage breakdown. Would it be new users joining or existing users moving from another platform (iOS, Android or Web potentially)?
It’s important to understand it as it could also backfire and split existing usage into 2 platforms rather than creating new one.
Mac app sine wave. In conclusion, bringing your app to macOS can be really exciting but it can come with complexity and cost, so it’s good to get ready for it.
Let’s also remember ourselves that when the first iOS SDK was release in 2008, every company wanted to turn their website into app, as irrelevant as it could be.
Mac Catalyst
Today, I think we need to be more careful about these decisions and make sure if you move forward, it’s acknowledging your user’s expectation.