Fix widgets on iOS 17

This commit is contained in:
Shadowfacts 2023-09-23 17:50:17 -04:00
parent f93f778cb2
commit 32feb827f1
1 changed files with 12 additions and 4 deletions

View File

@ -50,12 +50,22 @@ struct RecentsEntryView: View {
@Environment(\.widgetFamily) var family
var body: some View {
if #available(iOS 17.0, *) {
content
.containerBackground(.background, for: .widget)
} else {
content
.padding()
}
}
@ViewBuilder
private var content: some View {
if entry.items.isEmpty {
} else {
switch family {
case .systemSmall:
SquareItemView(item: entry.items[0])
.padding()
case .systemMedium, .systemLarge:
VStack {
@ -67,7 +77,6 @@ struct RecentsEntryView: View {
Spacer(minLength: 4)
}
}
.padding()
case .systemExtraLarge:
if #available(iOS 16.0, *) {
@ -86,7 +95,6 @@ struct RecentsEntryView: View {
}
}
}
.padding()
} else {
Text("Requires iOS 16")
}