I tried to add iOS 17 version check inside WidgetBundle but the widget extension keep on crashing .
Getting Thread 1: Swift runtime failure: Unexpectedly found nil while unwrapping an Optional value
. After removing the iOS 17 check it works fine.
Is there any way to provide version check inside widgetBundle?
struct MyWidgets: WidgetBundle {
@WidgetBundleBuilder
var body: some Widget {
widget1()
widget2()
if #available(iOSApplicationExtension 16.1, *) {
LiveActivity()
}
if #available(iOSApplicationExtension 17.0, *) {
ContactdWidget()
}
}
}