Determine if your iPad app is running on an M1 Mac

For a while now, we’ve been able to run iPad apps on an M1 Mac. From my experience, if your app is in any way complex, this probably isn’t the best way to get onto a Mac. However, for many apps, this is a good way to get something up and running relatively easily.

If your app makes sense, you might still want to exclude some functionality or change it on the Mac. With a “Designed for iPad” app, the typical OS checks do not work.


#if os(macOS)

If you can keep your support to iOS 14 and higher, you’ll want something like this:

import Foundation

func isIOSAppOnMac() -> Bool {
    var m1Check = false
    if #available(iOS 14.0, *) {
        m1Check = ProcessInfo.processInfo.isiOSAppOnMac
    return m1Check

You can use the ProcessInfo.processInfo.isiOSAppOnMac directly, but I’ve opted for the function that wraps check so it at least falls back if I’ve made a mistake.

One scenario where this comes in handy is CommandMenu with keyboard shortcuts.

.commands {
    CommandMenu(LocalizedStringKey("Do Things")) {
        Button(action:{ doThing() })
        Label(LocalizedStringKey("do thing"), systemImage: "bookmark")
    .keyboardShortcut("B", modifiers: .command)

At the time of publishing this, that code will crash on an M1 Mac. So, while not ideal, you might want to put a switch statement in your CommandMenu and have one set with keyboard shortcuts for iPad and a duplicated set for M1 Macs that will simply create the menu item minus any keyboard shortcuts.

Hopefully, this is something that will get fixed in the future, or you will get the time to create a full Mac app.