Fix widgets on iOS 17
This commit is contained in:
parent
f93f778cb2
commit
32feb827f1
|
@ -48,14 +48,24 @@ struct RecentsEntryView: View {
|
|||
let entry: RecentsEntry
|
||||
|
||||
@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")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue