Does TargetMachO="Target Apple", or just Mac?

With my cross platform projects, I leverage Ohanaware App Kit features in the Mac versions.

Thus, when I get a new release of OAK, I spend some time inserting “#if TargetMacOS or TargetIOS” into its methods, until cross-platform debug runs stop complaining. Then I export my tweaked OAK to put into the other projects. This takes a little time, but isn’t too overbearing.

I’m wondering whether “#if TargetMachO” would do just as well. Back in the day of the dinosaurs, this was used to differentiate OS X code from anything expected to also work on OS 9. One could infer that it would now work as I ask. However, the documentation does not address this. It was likely written before the iOS target was a thing.

At the moment this is theoretical, since I don’t actually have an iOS project to worry about. The projects at hand are just for desktop.

(I’ve also posted this question on another forum. I’ve gotten two opposing opinions, both from highly respected sources.) :slight_smile:

Thanks in advance.

Jerry

1 Like

You can use #if TargetMachO to detect macOS or iOS as currently

TargetMachO = TargetMacOS or TargetIOS

1 Like

With an iOS test project (named “Macho Camacho” because I have my silly side), it does not work.

The project presented a pushbutton which produced a message box with conditional text, based on #if TargetMachO/#Else. “No, it doesn’t work” was produced.

From appearances, “TargetMachO”, as it actually now works under the hood, has been superseded by TargetMacOS, and is essentially obsolete.