File tree 1 file changed +7
-4
lines changed
CodeEdit/Features/CodeFile 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ struct CodeFileView: View {
26
26
@Environment ( \. colorScheme)
27
27
private var colorScheme
28
28
29
+ @StateObject
30
+ private var themeModel : ThemeModel = . shared
31
+
29
32
private var cancellables = [ AnyCancellable] ( )
30
33
31
34
private let isEditable : Bool
@@ -99,15 +102,15 @@ struct CodeFileView: View {
99
102
)
100
103
// minHeight zero fixes a bug where the app would freeze if the contents of the file are empty.
101
104
. frame ( minHeight: . zero, maxHeight: . infinity)
102
- . onChange ( of: ThemeModel . shared . selectedTheme) { newValue in
105
+ . onChange ( of: themeModel . selectedTheme) { newValue in
103
106
guard let theme = newValue else { return }
104
107
self . selectedTheme = theme
105
108
}
106
109
. onChange ( of: colorScheme) { newValue in
107
110
if matchAppearance {
108
- ThemeModel . shared . selectedTheme = newValue == . dark
109
- ? ThemeModel . shared . selectedDarkTheme!
110
- : ThemeModel . shared . selectedLightTheme!
111
+ themeModel . selectedTheme = newValue == . dark
112
+ ? themeModel . selectedDarkTheme
113
+ : themeModel . selectedLightTheme
111
114
}
112
115
}
113
116
. onChange ( of: settingsFont) { _ in
You can’t perform that action at this time.
0 commit comments