@PinStudios Where you able to solve this? Im having the same issue, was able to solve it for lower version with the code below, but then it stops working for iOS 17.
struct MyWidgetBundle: WidgetBundle {
var body: some Widget {
if #available(iOS 17, *) {
// If iOS 17 allow both widgets + live activity
return WidgetBundleBuilder.buildBlock(MyWidget(), MyFavouriteWidget(), MyWidgetLiveActivity())
} else {
// This widgets wrap other validations to allow different widgets depending of the version
return Widgets()
}
}
private func Widgets() -> some Widget {
if #available(iOS 16.1, *) {
// If iOS 16.1 allow Favourite widget + live activity
return WidgetBundleBuilder.buildBlock(MyFavouriteWidget(), MyWidgetLiveActivity())
} else {
// If lower just allow Favourite Widget
return MyFavouriteWidget()
}
}
}
Topic:
Programming Languages
SubTopic:
Swift
Tags: