make styles optional in theme

This commit is contained in:
2026-07-12 11:36:27 +02:00
parent 70a170f544
commit 3da4c8e466
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
struct PHTheme: Decodable {
let window: PHThemeWindow
let texts: [PHThemeText]?
let styles: [PHThemeStyle]
let styles: [PHThemeStyle]?
private enum CodingKeys: String, CodingKey {
case window
+2 -2
View File
@@ -49,8 +49,8 @@ extension BarController {
}
func style(for block: PHBlock) -> PHThemeStyle {
guard let style = theme.styles.first(where: { $0.name == block.styleName }) else {
guard let defaultStyle = theme.styles.first(where: { $0.name == "default" }) else {
guard let style = theme.styles?.first(where: { $0.name == block.styleName }) else {
guard let defaultStyle = theme.styles?.first(where: { $0.name == "default" }) else {
return PHThemeStyle.default
}
return defaultStyle