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

View File

@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>

View File

@ -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"))
}
}
}