How can we add a Lock Screen Widget to an existing Widget Bundle and still support iOS 15? :thinking_face: for ex this won't compile
struct SecondExtraBundle: WidgetBundle {
@WidgetBundleBuilder
var body: some Widget {
DailyHeartRatesWidget()
if #available(iOSApplicationExtension 16.0, *) {
LockScreenRecoveryScoreWidget()//Requires iOS 16?
} else {
// Fallback on earlier versions
}
}
}
I think this should work. Simply return an
EmptyWidgetConfigurationin case the widget is not supported.This did not work before Xcode 14, but SE-0360 is already implemented and you can do this now.