Multiple widgets, only some with location permissions

I want to implement a bundle of Widgets, some that require location permission and some that do not.

In https://developer.apple.com/documentation/widgetkit/accessing-location-information-in-widgets they say

If your app provides multiple widgets and only some of the widgets use location, separate your widgets into multiple extensions. Add the NSWidgetWantsLocation to the extension that contains widgets that use location. This allows the system to only prompt the user for the widgets that use location information, and makes it more contextually relevant for users.

For more information, see the Declare Multiple Widgets in Your App Extension section in Creating a Widget Extension.

But this page, and the section on the referenced "Creating a Widget Extension" page doesn't describe exactly how to do this.

Am I supposed to create a "main" Widget Extension, that imports other WidgetExtensions, and the "main" extension declares the WidgetBundle? Or can I just create multiple (isolated) Widget Extensions in my app, and they will all be grouped in the widget selector?
Answered by Engineer in 648143022
You would want to create multiple isolated Widget Extensions. Then add the Widgets that require location to one of those extensions and the rest to your other extension(s).
Accepted Answer
You would want to create multiple isolated Widget Extensions. Then add the Widgets that require location to one of those extensions and the rest to your other extension(s).
Just tried two widget extensions on a blank new app, one that uses location and one that does not. Verified that only when adding widgets to the home screen from the extension that declares NSWidgetWantsLocation that the prompt for location permissions is displayed. Thanks!
Multiple widgets, only some with location permissions
 
 
Q