Article

Creating a Mac Version of Your iPad App

Bring your iPad app to macOS with Mac Catalyst.

Overview

Starting with Xcode 11, you can create a Mac version of your iPad app using Mac Catalyst. Configuring your app to run in macOS takes just a click in a checkbox. However, more steps may be needed depending on the system features and frameworks your app uses.

Configure Your App for Mac

To add support for macOS, open your Xcode project and select the iOS target that you want to configure. In the General tab, under Deployment Info, click the checkbox for the Mac device. (If your app supports iPhone only, the checkbox is unavailable.)

When you select Mac as a supported device, Xcode makes the following changes to your project:

  1. Adds a bundle identifier for the Mac version of your app.

  2. 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.

  3. Adds My Mac to the list of destinations that you can choose when running your app from Xcode.

  4. Excludes incompatible frameworks, app extensions, and other embedded content.

At this point, you may be able to build and run the Mac version of your app. To give it a try, select My Mac as the destination and run your project.

Go Beyond the Checkbox

You may find that the Mac version of your app still doesn’t build. Xcode excludes incompatible frameworks and embedded content where possible. However, you may need to manually exclude other content. To do this, go to the Frameworks, Libraries, and Embedded Content list under the General tab for your iOS target. Then select iOS as the platform setting for the item. This setting excludes the item from the Mac version of your app.

Your project likely contains code that no longer compiles because of frameworks or API that are unavailable to the Mac version of your app. To remedy this problem, find the code that doesn’t compile, and enclose it as shown here:

#if !targetEnvironment(macCatalyst)
// Code to exclude from Mac.
#endif

You can use these same approaches to include a framework and code that are available only in macOS. For a framework, select macOS for the platform setting, and enclose the code with a #if targetEnvironment(macCatalyst) statement.

Make Your App More Like a Mac App

After following these steps, you should be able to run your iPad app on Mac. But before you ship your new app to customers, it needs a few more changes to make it more like a Mac app. To learn more, see Optimizing Your iPad App for Mac.

Topics

Mac Optimizations

Optimizing Your iPad App for Mac

Make your iPad app more like a Mac app by taking advantage of system features in macOS.

Displaying a Preferences Window

Let users manage app settings defined in a Settings bundle through a system-provided preferences window.