make styles optional in theme
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user