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?
You will need to add it to the platforms
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