Feature Flagging Widgets & Widget Families

I am trying to feature flag widgets in my Widget extension. This feature flag value is stored remotely, read by my main app, and written to UserDefaults, then read from UserDefaults in my widget target. I understand that providing an empty array of WidgetFamilys will not show my app when the user goes to add a widget.

However, even when this flag flips to true, hard-closing and reopening my app will not show my app in the list of apps you can add a widget for. But I notice that if I recompile my app from Xcode (running the app's scheme, not the widget scheme), then my app will show when you search for an app to add a widget for, making me think that these Widget objects are only created by the system once when the app is initially installed/updated.

My concern is that I will not be able to flip this flag from false to true after the user has installed my app to do a rollout of my widget. Is this expected? Or is there an alternative or otherwise recommended way of doing this?

struct MyWidget: Widget {
  let kind = "MyWidget"

  var supportedFamilies: [WidgetFamily] {
    let manager = ExtensionManager()

    if manager.widgetsEnabled {
      return [.systemSmall, .systemMedium, .systemLarge]
    }
    else {
      return []
    }
  }

  var body: some WidgetConfiguration {
    IntentConfiguration(
      kind: kind,
      intent: MyWidgetIntent.self,
      provider: MyWidgetProvider()
    ) { entry in
      MyWidgetView(entry: entry)
    }
    .configurationDisplayName("My Widget")
    .description("Install my widget!")
    .supportedFamilies(supportedFamilies)
  }
}
Feature Flagging Widgets & Widget Families
 
 
Q