I'm working on a new iOS app with with widgets. Written in SwiftUI.
Most of my code is shared between the Widget target and the App target, but there are some minor style changes I want to make between the two targets.
Is there a way to check whether the code is executing in the widget or in the app?
Here is possible helper function to detect if you run in widget. Tested with Xcode 12 / iOS 14.