How to test Multiplatform SwiftUI app in Catalyst on a Mac

76 views Asked by At

I'm learning SwiftUI, and have a Multiplatform App I'm building. Selecting Multiplatform causes Xcode 15 to create both MacOS and iOS targets.

I would also like to test out my iOS app and make sure it works in Catalyst, since that would make that version useful for both platforms.

I don't see a way to test the iOS app on my Mac in Catalyst. It only lets me select the native Mac app as a Mac target. Is it possible, and if so, how? (Running Sonoma on the Mac, Xcode 15.1, and building an iOS 17 target.)

1

There are 1 answers

2
lorem ipsum On

The default project in Xcode 15 comes with

enter image description here

Where macOS is selected.

You have to change the target to Catalyst.

enter image description here

Notice at the top that the available Mac now says Catalyst.

If you want a macOS App and a Catalyst app you can add a separate target.

enter image description here

in Xcode 13 and 14 Apple would create a "Shared" folder where all the files within would be shared with all the targets.

enter image description here

When you want to swap between the MacOS and the iOS/Catalyst app you will have to switch the target.

enter image description here

But remember that a Catalyst app is for all intents and purposes an iOS app all the AppKit tools are not available you have to use UIKit.