Update widget, iOS 17 + backwards compatibility
This commit is contained in:
@@ -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"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user