Update widget, iOS 17 + backwards compatibility

This commit is contained in:
maddiebaka
2023-11-17 14:48:51 -05:00
parent 9f9f4c6409
commit e33e3402fc
2 changed files with 17 additions and 1 deletions
@@ -57,7 +57,7 @@ struct Toki_Trainer_WidgetsEntryView : View {
var body: some View {
ZStack {
Color("LightPurple")
//Color("LightPurple")
VStack(alignment: .leading) {
Text(entry.word)
.foregroundColor(Color("FontColorTitle"))
@@ -70,6 +70,20 @@ struct Toki_Trainer_WidgetsEntryView : View {
.padding(8)
}
}
.widgetBackground(backgroundView: Color("LightPurple"))
}
}
extension View {
func widgetBackground(backgroundView: some View) -> some View {
if #available(iOSApplicationExtension 17.0, *) {
return containerBackground(for: .widget) {
Color("LightPurple")
}
} else {
return background(Color("LightPurple"))
}
}
}