Ad

How Can I Publish An App For Both IOS And MacOS?

- 1 answer

I’m working on an iPhone/iPad app exclusively with Objective-C files.

Is there a way to build a Mac app without having to duplicate many of them?

Is there a way I can make custom button files (.h, .m) that work for both iOS and macOS?

Ad

Answer

You will need to add it to the platforms

enter image description here

enter image description here

and exclude the codes which wont work on MacOS with :

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

then you need to optimize your app for MacOs , more details on : https://developer.apple.com/documentation/uikit/mac_catalyst/optimizing_your_ipad_app_for_mac

Ad
source: stackoverflow.com
Ad