Detect if a widget is displayed in CarPlay vs. iPhone/iPad

I am looking into the new CarPlay support for systemSmall widgets introduced in iOS 26 (Apple documentation).

I am trying to figure out if there is a way to programmatically detect whether the widget is currently being displayed on the iPhone/iPad home/lock screen or in CarPlay.

So far, I haven’t found any information in the documentation or APIs that indicate how to distinguish between these environments. Is there an API, environment value, or best practice for handling this scenario?

Thanks in advance for any insights!

Detect if a widget is displayed in CarPlay vs. iPhone/iPad
 
 
Q