Post

Replies

Boosts

Views

Activity

Reply to WidgetBundle with ControlWidget does not work on iOS 17
I had to use a mix of things: import WidgetKit import SwiftUI @main struct widgetBundle: WidgetBundle { @WidgetBundleBuilder private var iOSAllWidgets: some Widget { LockScreenWidget() } @available(iOSApplicationExtension 17.0, iOS 17.0, *) @WidgetBundleBuilder private var iOS17Widgets: some Widget { LockScreenWidget() LiveActivityWidget() } @available(iOSApplicationExtension 18.0, iOS 18.0, *) @WidgetBundleBuilder private var iOS18Widgets: some Widget { LockScreenWidget() LiveActivityWidget() LauncherControlWidget() } var body: some Widget { if #available(iOSApplicationExtension 18.0, *) { return iOS18Widgets } else { return getWidgetsThatAreNOTControlWidgets() } } private func getWidgetsThatAreNOTControlWidgets() -> some Widget { if #available(iOSApplicationExtension 17.0, *) { return iOS17Widgets } else { return iOSAllWidgets } } } If you add more than one if else block in the body it complains about control flow statements. You can't use WidgetBundleBuilder.buildBlock for control widgets. If you try to use the function alone, it complains that the function does not return the same type for all the return statements because somehow control widget doesn't conform to widget. This will have to do until we get the fix in Xcode 16.1 beta 3.
Oct ’24
Reply to App not displayed in Settings App
I have the same issue with location permission. I tried adding a Settings bundle, it didn't work for me. What works for me while doing development, and only as a temporary fix, is to ask for NOTIFICATION permission on app launch and grant the notification permission, even if I don't need it in the app. My app appears in Settings immediately after granting notification permission. Not a great workaround but useful for my purposes while developing and testing with location permission.
Jan ’24