iOS app on MacOS M1 - Detect MacOS

IOS Apps can run on MacOS M1 devices. We have an IOS App that we'd like to run on MacOS, but would like to alter the behaviour of the app depending on whether or not the app is running on MacOS.

Behaviour we want to tailor:

  • Changing tooltips from 'tap' to 'click' and 'swipe' to 'scroll'.
  • Selecting higher resolution images from our game assets.

Is there a way to programatically detect that the app is running on MacOS? It seems the User Interface Idiom returns IPAD.

Answered by DTS Engineer in 716504022

The droid you’re looking for is the isiOSAppOnMac property on ProcessInfo.

ps I found this tidbit in Running Your iOS Apps on macOS. It, and the companion Adapting iOS Code to Run in the macOS Environment, are packed full of useful info.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

The droid you’re looking for is the isiOSAppOnMac property on ProcessInfo.

ps I found this tidbit in Running Your iOS Apps on macOS. It, and the companion Adapting iOS Code to Run in the macOS Environment, are packed full of useful info.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

iOS app on MacOS M1 - Detect MacOS
 
 
Q