Can I tell when my iOS Widget is running on MacOS (when Use IPhone Widgets is on)

I have an iOS Widget that also can load on the Mac when the Use iPhone Widgets setting is turned on on the Mac in Desktop & Dock.

I want to use a different url scheme to open video clips from the widget if it is being clicked on iOS or the Mac.

I tried using ProcessInfo.processInfo.isiOSAppOnMac but it always thinks it is on iOS.

I also tried looking for the user document path to see if it was /var/mobile/ or /Users/. but it always thinks it is /var/mobile.

I assume this is as it is not really a catalyst app but a WidgetKit extension from the phone.

Is there anyway I can figure out when the widget is running on the mac?

Thanks!

ProcessInfo.processInfo.isiOSAppOnMac;

In the original post you can see I tried that and it does not work. I think that only works for a catalyst app and not a widget running on the mac.

Maybe I can clarify a bit more. This is a widget from the iPhone that can de displayed as a widget on the mac it is not a separate app etc. There is an option on MacOS to allow iOS widgets on your dashboard and desktop and it gets them from your phone on the same appleid. It is not a designed for iPad or catalyst separate app. For all intents it looks like it thinks it is running on the iPhone (maybe it is not sure if your phone has to be around to get updates).

So unfortunately neither isiOSAppOnMac or isMacCataylstApp work as it isn't either of those. Nor does looking for the doc directory as it thinks it is iOS as well.

What is your goal, assuming this is possible to discover?

Sure good question. We have a custom url schme that our app can handle on iOS natively in app. On the mac I would just like to send it to our website which can also handle it here is the code I am trying to get to work

                            let baseURL = ProcessInfo.processInfo.isiOSAppOnMac ? "https://mywebsite.com" : "https://mycustomapphandler"
                            let urlString = "\(baseURL)/web/deep-redirect/VideoViewClips/\(savedClip.customerToken)?event_id=\(savedClip.eventId)&widget_id=\(WidgetTypeEnum.SavedClipThumbnailWidget.rawValue)"

Hopefully that makes sense. we have a customer url handler in the app for the widget but obviously not on the mac as we have no app but we can use the browser and our website.

Can I tell when my iOS Widget is running on MacOS (when Use IPhone Widgets is on)
 
 
Q