How to solve error: Cannot find 'containerBackground' in scope - Nextcloud iOS app clone

I have the source code for the nextcloud ios app ready to run on my machine, but after installing all the project dependencies every time I start the project in xcode I get the following errors:

  • Could not find ‘containerBackground’ in scope;
  • Value of type ‘some WidgetConfiguration’ has no member 'contentMarginsDisabled;

the code:

struct DashboardWidget: Widget {
let kind: String = “DashboardWidget”

var body: some WidgetConfiguration {
    IntentConfiguration(kind: kind, intent: DashboardIntent.self, provider: DashboardWidgetProvider()) { entry in
        DashboardWidgetView(entry: entry)
    }
    .supportedFamilies([.systemLarge])
    .configurationDisplayName("Dashboard")
    .description(NSLocalizedString("_description_dashboardwidget_", comment: ""))
    .contentMarginsDisabled()
}

}

extension View {
func widgetBackground(_ backgroundView: some View) → some View {
if #available(iOSApplicationExtension 17.0, *) {
return containerBackground(for: .widget) {
backgroundView
}
} else {
return background(backgroundView)
}
}
}

has anyone experienced this, how to solve these errors?

Try to run it on iOS 17, I think

1 Like