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"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>NSExtension</key> <key>NSExtension</key>
<dict> <dict>
<key>NSExtensionPointIdentifier</key> <key>NSExtensionPointIdentifier</key>

View File

@ -57,7 +57,7 @@ struct Toki_Trainer_WidgetsEntryView : View {
var body: some View { var body: some View {
ZStack { ZStack {
Color("LightPurple") //Color("LightPurple")
VStack(alignment: .leading) { VStack(alignment: .leading) {
Text(entry.word) Text(entry.word)
.foregroundColor(Color("FontColorTitle")) .foregroundColor(Color("FontColorTitle"))
@ -70,6 +70,20 @@ struct Toki_Trainer_WidgetsEntryView : View {
.padding(8) .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"))
}
} }
} }