Home > Software engineering >  How can I publish an app for both iOS and macOS?
How can I publish an app for both iOS and macOS?

Time:02-20

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?

CodePudding user response:

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

  • Related