I know I can change the views background colors in SwiftUI with this code:
.background(Color(.systemGroupedBackground))
But I can't do it for widget background color itself!
I use this code:
struct XWidget: Widget { // MARK: Widget is defined here
var body: some WidgetConfiguration {
StaticConfiguration(
kind: "xWidget",
provider: xProvider(),
placeholder: Text("Loading...")) { entry in
xWidgetEntryView(entry: entry).background(Color(.systemGroupedBackground)) // <= here
}.supportedFamilies([.systemSmall, .systemMedium, .systemLarge])
}
}
But the result is like this: