Open staskus opened 1 year ago
In order to remove this message we need to support containerBackground API. The best way is to create an extension so both iOS17 and <=iOS16 would be supported:
extension View {
func widgetBackground(_ backgroundView: some View) -> some View {
if #available(iOSApplicationExtension 17.0, *) {
return containerBackground(for: .widget) {
backgroundView
}
} else {
return background(backgroundView)
}
}
}
and attach it to the end of the view. This makes the background removable. Most notably, on iPadOS Lock Screen.
We use AccessoryWidgetBackground
for our background. I couldn't find a way to integrate to containerBackground
API, since SwiftUI requires to present it within ZStack. There were questions related to this on Apple forums. Likely that there's a solution I couldn't identify.
Tasks
Description
After building the app with Xcode 15, Home and Lock screen widgets are no longer working and show
please adopt containerBackground API
message:This is related to a new Removable background introduced at WWDC2023. More context:
Expected behavior
Widgets should support new APIs and this message should not be shown
Steps to reproduce the behavior
Tested on [device], iOS [version], Jetpack iOS / WordPress iOS [version]